Skip to content

Commit

Permalink
disable completion command
Browse files Browse the repository at this point in the history
  • Loading branch information
spy16 committed Jul 5, 2022
1 parent 7eb514f commit d8b5eed
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions moonshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ type App struct {
Routes func(r *chi.Mux)
}

func (cli *App) Launch(ctx context.Context, cmds ...*cobra.Command) int {
func (app *App) Launch(ctx context.Context, cmds ...*cobra.Command) int {
root := &cobra.Command{
Use: fmt.Sprintf("%s <command> [flags] <args>", cli.Name),
Short: cli.Short,
Long: cli.Long,
Use: fmt.Sprintf("%s <command> [flags] <args>", app.Name),
Short: app.Short,
Long: app.Long,
CompletionOptions: cobra.CompletionOptions{
DisableDefaultCmd: true,
},
}
root.PersistentFlags().StringP("config", "c", "", "Config file path override")

root.AddCommand(cmds...)
root.AddCommand(
cli.cmdServe(ctx),
cli.cmdShowConfigs(ctx),
app.cmdServe(ctx),
app.cmdShowConfigs(ctx),
)

if err := root.Execute(); err != nil {
Expand Down

0 comments on commit d8b5eed

Please sign in to comment.