🚧 Stub config command
This commit is contained in:
parent
a9c62f7d20
commit
1efc8671f5
2 changed files with 40 additions and 0 deletions
|
|
@ -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
35
commands/config.go
Normal 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")
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue