diff --git a/plan/command/command.go b/plan/command/command.go index 24c62b2..e38f325 100644 --- a/plan/command/command.go +++ b/plan/command/command.go @@ -20,36 +20,37 @@ type Flag struct { type Command struct { Name string - LocalID int - Type CommandType Description string Flags []*Flag Action func([]*Flag) error + Default bool } type CLI struct { - cmds []*Command + CMDS []*Command } -func (cli *CLI) ParseArg(args []string) *Command { - name, args := args[0], args[1:] - - cmds := cli.collection - id, err := strconv.Atoi(name) - if err == nil { - name, args = args[0], args[1:] - cmds = cli.single +func (cli *CLI) Run(args []string) *Command { + if len(args) == 0 { + args = []string{"list"} } - for _, c := range cmds { + id, err := strconv.Atoi(args[0]) + if err == nil { + args = args[1:] + } + if len(args) == 0 { + args = []string{"show"} + } + + for _, c := range cli.CMDS { if c.Name == name { - c.LocalID = id return c } } - flags := make([]*Flag, 0, len(args)) - for _, arg := range args { + // flags := make([]*Flag, 0, len(args)) + // for _, arg := range args { - } + // } } diff --git a/plan/command/command_test.go b/plan/command/command_test.go index cf859bd..b3d248c 100644 --- a/plan/command/command_test.go +++ b/plan/command/command_test.go @@ -1 +1,25 @@ package command_test + +import ( + "testing" + + "go-mod.ewintr.nl/planner/plan/command" +) + +func TestCommand(t *testing.T) { + t.Parallel() + + for _, tc := range []struct { + name string + args string + exp *command.Command + }{ + { + name: "default", + }, + } { + t.Run(tc.name, func(t *testing.T) { + + }) + } +} diff --git a/plan/command/show.go b/plan/command/show.go new file mode 100644 index 0000000..d47dcf0 --- /dev/null +++ b/plan/command/show.go @@ -0,0 +1 @@ +package command