[CLI] Add file listing to models/datasets/spaces ls (#4166)
* [CLI] Add file listing to models/datasets/spaces ls commands
When called with a repo ID, 'hf models ls', 'hf datasets ls', and
'hf spaces ls' now list files in the corresponding repo, matching
the behavior of 'hf buckets ls <bucket_id>'.
Supports --tree, -R (recursive), -h (human-readable), and --revision.
Shared file listing helpers are factored into _file_listing.py, and
buckets.py is refactored to use them too.
Co-authored-by: Lucain <Wauplin@users.noreply.github.com>
* [CLI] Fix bucket test fixture to patch format_date in _file_listing
The tree_bucket fixture was patching the now-removed _format_mtime
in buckets.py. Updated to patch format_date in _file_listing.py.
Co-authored-by: Lucain <Wauplin@users.noreply.github.com>
* I prefer it like this
* [CLI] Replace mocked file listing tests with real production tests
Use @with_production_testing against real repos:
- t5-small (model): JSON, quiet, tree, recursive outputs
- rajpurkar/squad (dataset): JSON output
- gradio/theme_builder (space): JSON output
Co-authored-by: Lucain <Wauplin@users.noreply.github.com>
* stop using Any everywhere...
* use expand otherwise we don't show dates
* I prefer it like this
* better typed
* stupid
* cursor feedback
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Lucain <Wauplin@users.noreply.github.com>