refactor!: split main function into commands BREAKING CHANGE: searchix-web requires `serve` argument
1 file changed, 34 insertions(+), 0 deletions(-)
changed files
A cmd/searchix-web/defaults.go
@@ -0,0 +1,34 @@ +package main + +import ( + "fmt" + + "github.com/Southclaws/fault" + + "alin.ovh/searchix/internal/config" +) + +type PrintDefaultsOptions struct{} + +func (*PrintDefaultsOptions) Execute(_ []string) error { + _, err := fmt.Print(config.GetDefaultConfig()) + if err != nil { + return fault.Wrap(err) + } + + return nil +} + +func init() { + var opts PrintDefaultsOptions + + _, err := parser.AddCommand( + "defaults", + "print defaults", + "print default configuration", + &opts, + ) + if err != nil { + panic(err) + } +}