Skip to content

refactor(cli): split cli.py into cli/ package#22

Merged
himewel merged 5 commits into
mainfrom
feat/cli-rich-output
May 9, 2026
Merged

refactor(cli): split cli.py into cli/ package#22
himewel merged 5 commits into
mainfrom
feat/cli-rich-output

Conversation

@himewel
Copy link
Copy Markdown
Owner

@himewel himewel commented May 9, 2026

No description provided.

himewel and others added 5 commits May 9, 2026 16:35
…columns

Rework all CLI presentations to match Typer/Rich conventions:

- search/info/pull now print Rich tables by default, with consistent
  styling via typer.echo / typer.secho (red bold errors, yellow API
  warnings on stderr) and an opt-in --tsv flag for tab-separated
  machine output.
- search: human-readable file sizes via rich.filesize.decimal; column
  labels renamed (type->media, file_extension->type, file_size->size,
  item_count->items) consistently across rich, --tsv, and --json; ids
  are always shown in full (overflow=fold).
- info: bold filename header + variations/files table with optional
  sidecars table; URLs preserved via overflow=fold.
- pull: pre-download summary table + green completion line.

BREAKING CHANGE: gopro-api search plain output now renders a Rich
table by default; previous tab-separated rows (with the "# _pages"
metadata line and header) require the new --tsv flag. JSON output for
search also renames per-item keys (type->media, file_extension->type,
file_size->size, item_count->items) inside _embedded.media[*].

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Move all CLI logic from the single gopro_api/cli.py module into a
dedicated gopro_api/cli/ package with one file per command (search,
info, pull) plus shared helpers in _common.py.

Co-authored-by: Cursor <cursoragent@cursor.com>
…mkdocs

Add missing Google-style docstrings to every public and private function
and method in the cli package (_common, app, info, pull, __main__).
Expand docs/api/cli.md with a Printers section referencing SearchPrinter,
InfoPrinter and PullPrinter so mkdocstrings renders them in the API site.

Co-authored-by: Cursor <cursoragent@cursor.com>
… helper

Introduce _SearchParams (frozen dataclass) to bundle the 7 search options,
reducing _run_search from 8 keyword arguments to 2. Extract the all-pages
streaming loop into _collect_all_pages to bring locals below the pylint
R0914 threshold. Suppress R0913 on the Typer callback search_command via
an inline pylint disable (framework callbacks must declare every CLI option
as a parameter and cannot be refactored further).

Co-authored-by: Cursor <cursoragent@cursor.com>
@himewel himewel merged commit 4503428 into main May 9, 2026
4 checks passed
@himewel himewel deleted the feat/cli-rich-output branch May 9, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant