NewAddCommand creates the add command
(validateEngine func(string) error)
| 96 | |
| 97 | // NewAddCommand creates the add command |
| 98 | func NewAddCommand(validateEngine func(string) error) *cobra.Command { |
| 99 | cmd := &cobra.Command{ |
| 100 | Use: "add <workflow>...", |
| 101 | Short: "Add agentic workflows from repositories or local files to .github/workflows", |
| 102 | Long: addCommandLong, |
| 103 | Example: addCommandExample, |
| 104 | Args: func(cmd *cobra.Command, args []string) error { |
| 105 | if len(args) < 1 { |
| 106 | return fmt.Errorf("missing workflow specification\n\nUsage:\n %s <workflow>...\n\nExamples:\n %[1]s githubnext/agentics/daily-repo-status Add from repository\n %[1]s ./my-workflow.md Add local workflow\n\nRun '%[1]s --help' for more information", cmd.CommandPath()) |
| 107 | } |
| 108 | return nil |
| 109 | }, |
| 110 | RunE: func(cmd *cobra.Command, args []string) error { |
| 111 | return runAddCommand(cmd, args, validateEngine) |
| 112 | }, |
| 113 | } |
| 114 | |
| 115 | registerAddCommandFlags(cmd) |
| 116 | return cmd |
| 117 | } |
| 118 | |
| 119 | func runAddCommand(cmd *cobra.Command, args []string, validateEngine func(string) error) error { |
| 120 | engineOverride, _ := cmd.Flags().GetString("engine") |