MCPcopy Create free account
hub / github.com/github/gh-aw / NewAddCommand

Function NewAddCommand

pkg/cli/add_command.go:98–117  ·  view source on GitHub ↗

NewAddCommand creates the add command

(validateEngine func(string) error)

Source from the content-addressed store, hash-verified

96
97// NewAddCommand creates the add command
98func 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
119func runAddCommand(cmd *cobra.Command, args []string, validateEngine func(string) error) error {
120 engineOverride, _ := cmd.Flags().GetString("engine")

Calls 3

runAddCommandFunction · 0.85
registerAddCommandFlagsFunction · 0.85
ErrorfMethod · 0.45