add list command to view available tasks

move init to a taks.go for centralization
This commit is contained in:
Robin Olsen
2026-02-18 13:19:16 +01:00
parent 23747fb799
commit f91d33e2f0
4 changed files with 28 additions and 12 deletions

View File

@@ -77,10 +77,22 @@ func runStartCmd(cmd *cobra.Command, args []string) error {
return nil
}
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
},
}
func init() {
rootCmd.CompletionOptions.DisableDefaultCmd = true
startCmd.Flags().StringVarP(&interfaceType, "interface", "i", "tui", "Specify interface.")
startCmd.Flags().IntVarP(&stage, "stage", "s", 1, "Run stage directly")
rootCmd.AddCommand(startCmd)
rootCmd.AddCommand(submitCmd)
rootCmd.AddCommand(listCmd)
}