🚧 Stub config command

This commit is contained in:
Dan Jones 2025-04-01 11:36:15 -05:00
commit 1efc8671f5
2 changed files with 40 additions and 0 deletions

View file

@ -13,5 +13,10 @@ type Command interface {
} }
func New(name string, args []string) (Command, error) { func New(name string, args []string) (Command, error) {
switch name {
case "config":
return newConfig(args)
}
return nil, fmt.Errorf("Unknown command: %s", name) return nil, fmt.Errorf("Unknown command: %s", name)
} }

35
commands/config.go Normal file
View file

@ -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")
}