Align `hf jobs ps` output with standard CLI pattern (#3799)
* Align `hf jobs ps` output with standard CLI pattern
Replace custom `_print_output`/`_tabulate` in `jobs_ps` and `scheduled_ps`
with the shared `print_list_output()` from `_cli_utils.py`, matching the
pattern used by `hf endpoints ls`, `hf models ls`, etc. (PR #3735).
Changes:
- `hf jobs ps` and `hf jobs scheduled ps` now use `print_list_output()`
- Add `--format table|json` (default: table) and `-q/--quiet` options
- Add hidden `--json` alias (per maintainer request)
- Job IDs are no longer truncated in table output
- Long COMMAND/IMAGE columns truncated via `_format_cell()` for readability
- Filter logic (`-f status=`, `-f label=`) preserved identically
- `jobs_stats` and `jobs_hardware` unchanged (live-updating display)
Breaking: removes old Go-template `--format '{{.id}}'` syntax. Use `-q`
for IDs or `--format json | jq` for custom field extraction.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Regenerate CLI docs for jobs ps format/quiet options
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update src/huggingface_hub/cli/jobs.py
Co-authored-by: célina <hanouticelina@gmail.com>
* Update src/huggingface_hub/cli/jobs.py
Co-authored-by: célina <hanouticelina@gmail.com>
* Fix missing closing paren from accepted suggestion
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Handle empty results for JSON and quiet output modes
Per review: `--format json` now outputs `[]` and `-q` outputs nothing
when no jobs match, instead of printing "No jobs found" which would
break consumers piping to jq or parsing IDs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add tests for jobs ps output formats
Test --format json, --json alias, -q quiet mode, table with full IDs,
and empty-result handling for both JSON and quiet modes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix indentation in scheduled_ps row_fn
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Re-add Go-template --format backward compat for jobs ps
Keep support for legacy `--format '{{.id}}'` Go-template syntax
alongside the new table/json/quiet modes, per reviewer request.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: célina <hanouticelina@gmail.com>