refactor to decouple commands form entrypoint for reusability and centralizing commands.
Increase reusability and composition
This commit is contained in:
17
internal/commands/survey/list.go
Normal file
17
internal/commands/survey/list.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package surveyCmd
|
||||
|
||||
import (
|
||||
"github.com/LazyBachelor/LazyPM/pkg/task"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var ListCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List available tasks",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
for i, name := range task.List() {
|
||||
cmd.Printf("%d. %s\n", i+1, name)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user