Skip to content

Commit d6af60a

Browse files
yeldarbyclaude
andcommitted
feat(cli): color-coded help matching typer's Rich styling
Options use typer's color scheme: bold cyan for long flags, bold green for short flags, bold yellow for metavar (TEXT). Commands use cyan for group name and bold for verb, giving a visual indication that they're tied together. Top-level commands (download, infer, search) are just bold. 374 tests pass, all linting clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3e5e732 commit d6af60a

1 file changed

Lines changed: 36 additions & 16 deletions

File tree

roboflow/cli/__init__.py

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -122,25 +122,45 @@ def _walk(group: Any, prefix: str = "") -> None:
122122
console.print(f" {_DESCRIPTION}", highlight=False)
123123
console.print()
124124

125-
# Options panel
126-
opt_table = Table(show_header=False, box=None, padding=(0, 2))
127-
opt_table.add_column(style="bold", no_wrap=True)
128-
opt_table.add_column()
129-
opt_table.add_row("--api-key -k TEXT", "API key override (default: $ROBOFLOW_API_KEY or config file)")
130-
opt_table.add_row("--json -j", "Output results as JSON (stable schema, for agents and piping)")
131-
opt_table.add_row("--quiet -q", "Suppress non-essential output (progress bars, status messages)")
132-
opt_table.add_row("--version -v", "Show package version and exit")
133-
opt_table.add_row("--workspace -w TEXT", "Workspace URL or ID override (default: configured default)")
134-
opt_table.add_row("--help -h", "Show this message and exit.")
125+
# Options panel — match typer's color scheme
126+
options_data = [
127+
("--api-key", "-k", "TEXT", "API key override (default: $ROBOFLOW_API_KEY or config file)"),
128+
("--json", "-j", "", "Output results as JSON (stable schema, for agents and piping)"),
129+
("--quiet", "-q", "", "Suppress non-essential output (progress bars, status messages)"),
130+
("--version", "-v", "", "Show package version and exit"),
131+
("--workspace", "-w", "TEXT", "Workspace URL or ID override (default: configured default)"),
132+
("--help", "-h", "", "Show this message and exit."),
133+
]
134+
opt_table = Table(show_header=False, box=None, padding=(0, 1))
135+
opt_table.add_column(no_wrap=True) # flags
136+
opt_table.add_column() # description
137+
for long_flag, short_flag, metavar, desc in options_data:
138+
flag_text = Text()
139+
flag_text.append(long_flag, style="bold cyan")
140+
flag_text.append(" ")
141+
flag_text.append(short_flag, style="bold green")
142+
if metavar:
143+
flag_text.append(" ")
144+
flag_text.append(metavar, style="bold yellow")
145+
opt_table.add_row(flag_text, desc)
135146
console.print(Panel(opt_table, title="Options", title_align="left", border_style="dim"))
136147

137-
# Commands panel
138-
cmd_table = Table(show_header=False, box=None, padding=(0, 2))
139-
cmd_table.add_column(style="bold", no_wrap=True)
140-
cmd_table.add_column()
148+
# Commands panel — group name in dim cyan, verb in bold
149+
cmd_table = Table(show_header=False, box=None, padding=(0, 1))
150+
cmd_table.add_column(no_wrap=True) # command name
151+
cmd_table.add_column() # description
141152
for cmd_name, help_text in commands:
142-
cmd_table.add_column
143-
cmd_table.add_row(cmd_name, help_text)
153+
parts = cmd_name.split(" ", 1)
154+
styled_name = Text()
155+
if len(parts) == 1:
156+
# Top-level command (no group): just bold
157+
styled_name.append(parts[0], style="bold")
158+
else:
159+
# Group + verb: group in dim cyan, verb in bold
160+
styled_name.append(parts[0], style="cyan")
161+
styled_name.append(" ")
162+
styled_name.append(parts[1], style="bold")
163+
cmd_table.add_row(styled_name, help_text)
144164
console.print(Panel(cmd_table, title="Commands", title_align="left", border_style="dim"))
145165
console.print()
146166

0 commit comments

Comments
 (0)