Skip to content

Commit 29dfc7e

Browse files
committed
feat(cli): add advanced command hint to help output
Add a hint at the bottom of `azldev --help` pointing users to the hidden `advanced` command group, which contains essential tools (mock, mcp, wget). This improves discoverability without fully unhiding the advanced commands. Closes #33
1 parent 344e4e9 commit 29dfc7e

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

internal/app/azldev/app.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ lives), or use -C to point to one.`,
155155

156156
app.cmd.SetHelpCommandGroupID(CommandGroupMeta)
157157
app.cmd.SetCompletionCommandGroupID(CommandGroupMeta)
158+
app.addAdvancedCommandHint()
158159

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

183+
// addAdvancedCommandHint customizes the root help output to include a hint about
184+
// the hidden "advanced" command group.
185+
func (a *App) addAdvancedCommandHint() {
186+
defaultHelp := a.cmd.HelpFunc()
187+
a.cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
188+
defaultHelp(cmd, args)
189+
190+
if cmd == cmd.Root() {
191+
fmt.Fprintln(cmd.OutOrStdout(),
192+
`Use "azldev advanced --help" for additional tools (mock, mcp, wget).`)
193+
}
194+
})
195+
}
196+
182197
// Returns the names of the app's commands. The optional provided list of ancestors
183198
// instructs this function to traverse through the command hierarchy before retrieving
184199
// child names. This function is largely intended for tests to introspect on the

scenario/__snapshots__/TestSnapshotsContainer_--help_stdout_1.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ Flags:
3939

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

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

scenario/__snapshots__/TestSnapshotsContainer_help_stdout_1.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ Flags:
3939

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

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

scenario/__snapshots__/TestSnapshots_--help_stdout_1.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ Flags:
3939

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

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

scenario/__snapshots__/TestSnapshots_--help_with_color_stdout_1.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ Meta commands:
3939

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

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

scenario/__snapshots__/TestSnapshots_help_stdout_1.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ Flags:
3939

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

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

0 commit comments

Comments
 (0)