Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 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,18 @@ lives), or use -C to point to one.`,
return app
}

// addAdvancedCommandHint embeds a hint about the hidden "advanced" command group
// into the root command's usage template so that DisableExtraNewlines handles
// trailing whitespace consistently.
func (a *App) addAdvancedCommandHint() {
tmpl := a.cmd.UsageTemplate()
tmpl = strings.TrimSuffix(tmpl, "\n")
tmpl += `{{if not .HasParent}}
Use "{{.CommandPath}} advanced --help" for additional tools (mock, mcp, wget).{{end}}
`
a.cmd.SetUsageTemplate(tmpl)
}

// 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 @@ -31,6 +31,7 @@ Flags:
--version version for azldev

Use "azldev [command] --help" for more information about a command.
Use "azldev advanced --help" for additional tools (mock, mcp, wget).


##:##:## ERR Error: unknown flag: --bogus-flag
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ Flags:
--version version for azldev

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 @@ -38,4 +38,5 @@ Flags:
--version version for azldev

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 @@ -31,6 +31,7 @@ Flags:
--version version for azldev

Use "azldev [command] --help" for more information about a command.
Use "azldev advanced --help" for additional tools (mock, mcp, wget).


##:##:## ERR Error: unknown flag: --bogus-flag
1 change: 1 addition & 0 deletions scenario/__snapshots__/TestSnapshots_--help_stdout_1.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ Flags:
--version version for azldev

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 @@ -38,4 +38,5 @@ Meta commands:
--version version for azldev

Use "azldev [command] --help" for more information about a command.
Use "azldev advanced --help" for additional tools (mock, mcp, wget).

1 change: 1 addition & 0 deletions scenario/__snapshots__/TestSnapshots_help_stdout_1.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ Flags:
--version version for azldev

Use "azldev [command] --help" for more information about a command.
Use "azldev advanced --help" for additional tools (mock, mcp, wget).

Loading