Skip to content

Commit c217b7a

Browse files
yeldarbyclaude
andcommitted
feat(cli): pure noun-verb help — hide top-level aliases, fix truncation
All commands in --help are now consistently 'noun verb' format: - Hidden: download (→ version download), infer (→ video infer exists), search (→ image search / universe search exist) - All hidden aliases still work, just not shown in help - Fixed description truncation: use full short_help instead of get_short_help_str() which Click caps at ~45 chars 374 tests pass, all linting clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d6af60a commit c217b7a

4 files changed

Lines changed: 9 additions & 17 deletions

File tree

roboflow/cli/__init__.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ def _walk(group: Any, prefix: str = "") -> None:
110110
if hasattr(cmd, "list_commands") and cmd.list_commands(None):
111111
_walk(cmd, full)
112112
else:
113-
commands.append((full, cmd.get_short_help_str() or ""))
113+
# Use the full short_help (not truncated get_short_help_str)
114+
help_text = getattr(cmd, "short_help", None) or cmd.get_short_help_str() or ""
115+
commands.append((full, help_text))
114116

115117
_walk(click_app)
116118
commands.sort(key=lambda x: x[0])
@@ -193,12 +195,6 @@ def _walk(group: Any, prefix: str = "") -> None:
193195
app.add_typer(batch_app, name="batch")
194196
app.add_typer(completion_app, name="completion")
195197
app.add_typer(deployment_app, name="deployment")
196-
197-
# "download" alias — registered here alphabetically (visible shorthand)
198-
from roboflow.cli.handlers._aliases import register_download_alias # noqa: E402
199-
200-
register_download_alias(app)
201-
202198
app.add_typer(folder_app, name="folder")
203199
app.add_typer(image_app, name="image")
204200

roboflow/cli/handlers/_aliases.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
from roboflow.cli._compat import ctx_to_args
1717

1818

19-
def register_download_alias(app: typer.Typer) -> None:
20-
"""Register the visible ``download`` shorthand at its alphabetical position."""
19+
def register_hidden_aliases(app: typer.Typer) -> None:
20+
"""Register all hidden backwards-compat aliases (not shown in --help)."""
2121

22-
@app.command("download")
22+
@app.command("download", hidden=True)
2323
def download_alias(
2424
ctx: typer.Context,
2525
url_or_id: Annotated[
@@ -28,16 +28,12 @@ def download_alias(
2828
format: Annotated[str, typer.Option("-f", "--format", help="Export format")] = "voc",
2929
location: Annotated[Optional[str], typer.Option("-l", "--location", help="Download location")] = None,
3030
) -> None:
31-
"""Download a dataset version (shorthand for 'version download')."""
31+
"""Download a dataset version (alias for 'version download')."""
3232
from roboflow.cli.handlers.version import _download
3333

3434
args = ctx_to_args(ctx, url_or_id=url_or_id, format=format, location=location)
3535
_download(args)
3636

37-
38-
def register_hidden_aliases(app: typer.Typer) -> None:
39-
"""Register all hidden backwards-compat aliases (not shown in --help)."""
40-
4137
@app.command("login", hidden=True)
4238
def login_alias(
4339
ctx: typer.Context,

roboflow/cli/handlers/infer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def infer_command(app: typer.Typer) -> None:
1313
"""Register the top-level ``infer`` command on *app*."""
1414

15-
@app.command("infer")
15+
@app.command("infer", hidden=True)
1616
def infer(
1717
ctx: typer.Context,
1818
file: Annotated[str, typer.Argument(help="Path to an image file")],

roboflow/cli/handlers/search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def search_command(app: typer.Typer) -> None:
1313
"""Register the top-level ``search`` command on *app*."""
1414

15-
@app.command("search")
15+
@app.command("search", hidden=True)
1616
def search(
1717
ctx: typer.Context,
1818
query: Annotated[str, typer.Argument(help="Search query (e.g. 'tag:review' or '*')")],

0 commit comments

Comments
 (0)