Skip to content

Commit 369550e

Browse files
Fix duplicate Flags section in exec help output
- Move examples from Long to Example field for proper Cobra formatting - Remove manual Flags documentation from Long field - Let Cobra automatically generate the Flags section - Improves help readability by eliminating duplication
1 parent b9fe8d0 commit 369550e

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

cmd/exec/root.go

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ arbitrary commands in a component's container.
6868
The component ID can be provided as the first positional argument, or it will use
6969
the component ID from your current context.
7070
71-
Examples:
72-
# Get an interactive shell (auto-enables --tty --stdin)
71+
The '--' separator is used to separate command flags from the command to execute.
72+
Everything after '--' is passed as the command to run in the container.
73+
74+
If no command is specified, defaults to an interactive shell (/bin/sh) with
75+
--tty and --stdin automatically enabled.`,
76+
Example: ` # Get an interactive shell (auto-enables --tty --stdin)
7377
bns exec comp-123
7478
7579
# Run a single command (no TTY/stdin needed)
@@ -86,21 +90,7 @@ Examples:
8690
bns exec --tty --stdin
8791
8892
# Specify namespace
89-
bns exec comp-123 --tty --stdin -n default --pod my-pod -- sh
90-
91-
Flags:
92-
--tty Allocate a pseudo-TTY (commonly used with --stdin for interactive sessions)
93-
--stdin Pass stdin to the container (commonly used with --tty for interactive sessions)
94-
-c, --container Container name (interactive selection if not specified)
95-
--pod Pod name (interactive selection if not specified)
96-
-n, --namespace Kubernetes namespace (auto-detected if not specified)
97-
--cluster-server Override kubeconfig cluster server
98-
99-
The '--' separator is used to separate command flags from the command to execute.
100-
Everything after '--' is passed as the command to run in the container.
101-
102-
If no command is specified, defaults to an interactive shell (/bin/sh) with
103-
--tty and --stdin automatically enabled.`,
93+
bns exec comp-123 --tty --stdin -n default --pod my-pod -- sh`,
10494

10595
Args: cobra.ArbitraryArgs,
10696
ValidArgsFunction: cobra.NoFileCompletions,

0 commit comments

Comments
 (0)