Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions internal/app/azldev/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ lives), or use -C to point to one.`,

app.cmd.SetHelpCommandGroupID(CommandGroupMeta)
app.cmd.SetCompletionCommandGroupID(CommandGroupMeta)
app.addAdvancedCommandHint()

// Define global flags and configuration settings.
app.cmd.PersistentFlags().BoolVarP(&app.verbose, "verbose", "v", false, "enable verbose output")
Expand All @@ -179,6 +180,20 @@ lives), or use -C to point to one.`,
return app
}

// addAdvancedCommandHint customizes the root help output to include a hint about
// the hidden "advanced" command group.
func (a *App) addAdvancedCommandHint() {
defaultHelp := a.cmd.HelpFunc()
a.cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
defaultHelp(cmd, args)

if cmd == cmd.Root() {
fmt.Fprintln(cmd.OutOrStdout(),
`Use "azldev advanced --help" for additional tools (mock, mcp, wget).`)
}
})
}

// Returns the names of the app's commands. The optional provided list of ancestors
// instructs this function to traverse through the command hierarchy before retrieving
// child names. This function is largely intended for tests to introspect on the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ Flags:

Use "azldev [command] --help" for more information about a command.

Use "azldev advanced --help" for additional tools (mock, mcp, wget).

Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ Flags:

Use "azldev [command] --help" for more information about a command.

Use "azldev advanced --help" for additional tools (mock, mcp, wget).

2 changes: 2 additions & 0 deletions scenario/__snapshots__/TestSnapshots_--help_stdout_1.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ Flags:

Use "azldev [command] --help" for more information about a command.

Use "azldev advanced --help" for additional tools (mock, mcp, wget).

Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ Meta commands:

Use "azldev [command] --help" for more information about a command.

Use "azldev advanced --help" for additional tools (mock, mcp, wget).
2 changes: 2 additions & 0 deletions scenario/__snapshots__/TestSnapshots_help_stdout_1.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ Flags:

Use "azldev [command] --help" for more information about a command.

Use "azldev advanced --help" for additional tools (mock, mcp, wget).

Loading