Skip to content

Commit

Permalink
Merge pull request #9 from github/deborah-digges/rename-models-root-c…
Browse files Browse the repository at this point in the history
…ommand

[GitHub models] Rename models root command
  • Loading branch information
Deborah-Digges authored Oct 10, 2024
2 parents b1bfb30 + 6f77e9c commit d3444ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@ import (
"github.com/github/gh-models/cmd/run"
"github.com/github/gh-models/cmd/view"
"github.com/spf13/cobra"
"strings"
)

func NewRootCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "gh models",
Use: "models",
Short: "GitHub Models extension",
}

cmd.AddCommand(list.NewListCommand())
cmd.AddCommand(run.NewRunCommand())
cmd.AddCommand(view.NewViewCommand())

// Cobra doesn't have a way to specify a two word command (ie. "gh models"), so set a custom usage template
// with `gh`` in it. Cobra will use this template for the root and all child commands.
cmd.SetUsageTemplate(strings.NewReplacer(
"{{.UseLine}}", "gh {{.UseLine}}",
"{{.CommandPath}}", "gh {{.CommandPath}}").Replace(cmd.UsageTemplate()))
return cmd
}

0 comments on commit d3444ed

Please sign in to comment.