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