diff options
author | Alan Pearce | 2024-05-20 18:46:20 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-20 18:46:20 +0200 |
commit | a90419aa46ec42588f65e6327559ce479f9c5b67 (patch) | |
tree | 449e3d50d8449bf63a48462513e59858716879a7 | |
parent | be3bab7fc4f8c3efc87cf7cfcc83d63177fdd7b9 (diff) | |
download | searchix-a90419aa46ec42588f65e6327559ce479f9c5b67.tar.lz searchix-a90419aa46ec42588f65e6327559ce479f9c5b67.tar.zst searchix-a90419aa46ec42588f65e6327559ce479f9c5b67.zip |
feat(config): use enums' string representations to print defaults
-rw-r--r-- | defaults.toml | 16 | ||||
-rw-r--r-- | internal/config/fetcher.go | 4 | ||||
-rw-r--r-- | internal/config/importer-type.go | 4 |
3 files changed, 16 insertions, 8 deletions
diff --git a/defaults.toml b/defaults.toml index 9b5760d..38aa421 100644 --- a/defaults.toml +++ b/defaults.toml @@ -54,8 +54,8 @@ UpdateAt = '04:00:00' Name = 'Darwin' Key = 'darwin' Enable = false -Fetcher = 1 -Importer = 2 +Fetcher = 'channel' +Importer = 'options' Channel = 'darwin' URL = 'https://github.com/LnL7/nix-darwin/archive/master.tar.gz' Attribute = 'options' @@ -74,8 +74,8 @@ Revision = '' Name = 'Home Manager' Key = 'home-manager' Enable = false -Fetcher = 1 -Importer = 2 +Fetcher = 'channel' +Importer = 'options' Channel = 'home-manager' URL = 'https://github.com/nix-community/home-manager/archive/master.tar.gz' Attribute = 'docs.json' @@ -94,8 +94,8 @@ Revision = '' Name = 'NixOS' Key = 'nixos' Enable = true -Fetcher = 1 -Importer = 2 +Fetcher = 'channel' +Importer = 'options' Channel = 'nixpkgs' URL = 'https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz' Attribute = 'options' @@ -114,8 +114,8 @@ Revision = '' Name = 'Nix Packages' Key = 'nixpkgs' Enable = true -Fetcher = 2 -Importer = 1 +Fetcher = 'channel-nixpkgs' +Importer = 'packages' Channel = 'nixos-unstable' URL = '' Attribute = '' diff --git a/internal/config/fetcher.go b/internal/config/fetcher.go index a01abbd..fd95b32 100644 --- a/internal/config/fetcher.go +++ b/internal/config/fetcher.go @@ -47,3 +47,7 @@ func (f *Fetcher) UnmarshalText(text []byte) error { return err } + +func (f *Fetcher) MarshalText() ([]byte, error) { + return []byte(f.String()), nil +} diff --git a/internal/config/importer-type.go b/internal/config/importer-type.go index 0d0263c..8f64d58 100644 --- a/internal/config/importer-type.go +++ b/internal/config/importer-type.go @@ -42,3 +42,7 @@ func (i *ImporterType) UnmarshalText(text []byte) error { return err } + +func (i *ImporterType) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} |