diff --git a/internal/app/azldev/app.go b/internal/app/azldev/app.go index 9d90ccd..0ae2e9c 100644 --- a/internal/app/azldev/app.go +++ b/internal/app/azldev/app.go @@ -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") @@ -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 diff --git a/scenario/__snapshots__/TestSnapshotsContainer_--bogus-flag_stderr_1.snap b/scenario/__snapshots__/TestSnapshotsContainer_--bogus-flag_stderr_1.snap index 719f467..ed7793b 100755 --- a/scenario/__snapshots__/TestSnapshotsContainer_--bogus-flag_stderr_1.snap +++ b/scenario/__snapshots__/TestSnapshotsContainer_--bogus-flag_stderr_1.snap @@ -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 diff --git a/scenario/__snapshots__/TestSnapshotsContainer_--help_stdout_1.snap b/scenario/__snapshots__/TestSnapshotsContainer_--help_stdout_1.snap index 99f4df9..05278ee 100755 --- a/scenario/__snapshots__/TestSnapshotsContainer_--help_stdout_1.snap +++ b/scenario/__snapshots__/TestSnapshotsContainer_--help_stdout_1.snap @@ -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). diff --git a/scenario/__snapshots__/TestSnapshotsContainer_help_stdout_1.snap b/scenario/__snapshots__/TestSnapshotsContainer_help_stdout_1.snap index 99f4df9..05278ee 100755 --- a/scenario/__snapshots__/TestSnapshotsContainer_help_stdout_1.snap +++ b/scenario/__snapshots__/TestSnapshotsContainer_help_stdout_1.snap @@ -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). diff --git a/scenario/__snapshots__/TestSnapshots_--bogus-flag_stderr_1.snap b/scenario/__snapshots__/TestSnapshots_--bogus-flag_stderr_1.snap index 719f467..ed7793b 100755 --- a/scenario/__snapshots__/TestSnapshots_--bogus-flag_stderr_1.snap +++ b/scenario/__snapshots__/TestSnapshots_--bogus-flag_stderr_1.snap @@ -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 diff --git a/scenario/__snapshots__/TestSnapshots_--help_stdout_1.snap b/scenario/__snapshots__/TestSnapshots_--help_stdout_1.snap index 99f4df9..05278ee 100755 --- a/scenario/__snapshots__/TestSnapshots_--help_stdout_1.snap +++ b/scenario/__snapshots__/TestSnapshots_--help_stdout_1.snap @@ -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). diff --git a/scenario/__snapshots__/TestSnapshots_--help_with_color_stdout_1.snap b/scenario/__snapshots__/TestSnapshots_--help_with_color_stdout_1.snap index 5ec50a0..df307d9 100755 --- a/scenario/__snapshots__/TestSnapshots_--help_with_color_stdout_1.snap +++ b/scenario/__snapshots__/TestSnapshots_--help_with_color_stdout_1.snap @@ -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). diff --git a/scenario/__snapshots__/TestSnapshots_help_stdout_1.snap b/scenario/__snapshots__/TestSnapshots_help_stdout_1.snap index 99f4df9..05278ee 100755 --- a/scenario/__snapshots__/TestSnapshots_help_stdout_1.snap +++ b/scenario/__snapshots__/TestSnapshots_help_stdout_1.snap @@ -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).