From 1efc8671f5ee4c9ed905fa0e93ba2c2adfef86f6 Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Tue, 1 Apr 2025 11:36:15 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Stub=20config=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/cmds.go | 5 +++++ commands/config.go | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 commands/config.go diff --git a/commands/cmds.go b/commands/cmds.go index 13e2b6c..bdc1637 100644 --- a/commands/cmds.go +++ b/commands/cmds.go @@ -13,5 +13,10 @@ type Command interface { } func New(name string, args []string) (Command, error) { + switch name { + case "config": + return newConfig(args) + } + return nil, fmt.Errorf("Unknown command: %s", name) } diff --git a/commands/config.go b/commands/config.go new file mode 100644 index 0000000..6742ed7 --- /dev/null +++ b/commands/config.go @@ -0,0 +1,35 @@ +package commands + +import ( + "errors" + + "github.com/spf13/pflag" +) + +type conf struct { + flags *pflag.FlagSet +} + +func newConfig(args []string) (conf, error) { + cf := conf{flags: initFlags()} + err := cf.flags.Parse(args) + return cf, err +} + +func initFlags() *pflag.FlagSet { + fl := pflag.NewFlagSet("config", pflag.ExitOnError) + // TODO add flags + return fl +} + +func (c conf) Name() string { + return "config" +} + +func (c conf) FlagSet() *pflag.FlagSet { + return c.flags +} + +func (c conf) Run() error { + return errors.New("unimplemented") +}