feat: add --summary flag to display file statistics#1709
Open
avih7531 wants to merge 2 commits intoeza-community:mainfrom
Open
feat: add --summary flag to display file statistics#1709avih7531 wants to merge 2 commits intoeza-community:mainfrom
avih7531 wants to merge 2 commits intoeza-community:mainfrom
Conversation
Adds a new --summary flag that displays a summary at the end of output showing counts of directories, files, and symlinks. The summary respects the --icons flag, displaying appropriate icons when enabled. This implementation is compatible with the new clap-based CLI parser introduced in PR eza-community#1447. Features: - Counts all displayed items (files, directories, symlinks separately) - Works with --recurse to count all items recursively - Works with --tree to count all items in the tree view - Icon support: shows folder/file/symlink icons when --icons is enabled - Plain text mode when icons are disabled or --icons=never - Clean, aligned output formatting Changes: - Added --summary flag to clap parser in src/options/parser.rs - Added Summary struct and counting logic in src/main.rs - Updated View struct in src/output/mod.rs and src/options/view.rs - Added man page documentation in man/eza.1.md - Added shell completions for bash, zsh, fish, and nushell - Updated README.md - Added integration tests for --summary flag Tests: - Added tests/cmd/summary_all.* for basic summary - Added tests/cmd/summary_icons_all.* for summary with icons - Added tests/cmd/summary_tree_unix.* for tree mode with summary - All local cargo tests pass (331 unit tests + integration tests)
- Added tests/gen/summary_nix.* for basic summary - Added tests/gen/summary_long_nix.* for summary with long view - Added tests/gen/summary_tree_nix.* for summary with tree view - Added tests/gen/summary_recurse_nix.* for summary with recursive mode These tests validate the --summary flag works correctly in the Nix build environment with the test_dir structure.
67633b3 to
e479256
Compare
Author
|
This PR is a better #1699 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new
--summaryflag that displays a summary of file counts at the end of eza's output.Changes
--summary(no short flag, as-sis used by--sort)--iconsflag setting--recurseand--treemodesTesting
✅ All local cargo tests pass (331 unit tests + 7 integration tests)
Tested manually with:
eza --summaryeza --summary --icons=alwayseza --summary --icons=nevereza --summary --recurseeza --summary --treeeza --summary --longExample Output
With icons:
Without icons:
Implementation Details
count_files_recursive()--iconsflag (always/auto/never)--summaryflag is presentChecklist
Test Coverage
Added integration tests:
tests/cmd/summary_all.*- Basic summarytests/cmd/summary_icons_all.*- Summary with iconstests/cmd/summary_tree_unix.*- Tree mode with summarytests/gen/summary_nix.*- Nix environment testtests/gen/summary_long_nix.*- Long view with summarytests/gen/summary_tree_nix.*- Tree view with summarytests/gen/summary_recurse_nix.*- Recursive mode with summary