Add --focus-root feature for focused tree views - #28
Open
yarikoptic wants to merge 1 commit into
Open
yarikoptic wants to merge 1 commit into
yarikoptic wants to merge 1 commit into
Conversation
Adds the ability to show a "focused" view of the tree, where specific
deep path(s) are fully expanded while sibling directories/files are
collapsed with optional summary counts.
New options:
--focus-root X Show tree from X, treating directory arguments as
focus paths. Collapses siblings not on focus paths.
--no-focus-counts Hide counts in collapsed summaries (show just "...")
--focus-collapse X Collapse mode controlling what gets collapsed:
- none (default): Named folder collapse, show files
- files: Named folder collapse, collapse files too
- folders: Anonymous collapse for dirs, show files
- all: Anonymous collapse for everything
--focus-collapse-limit # Show first # consecutive collapsed items
individually, then switch to anonymous summary
Example:
tree --focus-root . --focus-collapse-limit 5 path/to/target
This shows the tree from current directory, fully expanding path/to/target,
while showing first 5 sibling directories with named collapse format
(dirname/... (N subdirs, M files)) then collapsing the rest into a summary.
Fixes Old-Man-Programmer#26
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Author
|
ping on the PR for any feedback etc |
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.
Adds the ability to show a "focused" view of the tree, where specific deep path(s) are fully expanded while sibling directories/files are collapsed with optional summary counts.
New options:
Example:
This shows the tree from current directory, fully expanding path/to/target, while showing first 5 sibling directories with named collapse format (dirname/... (N subdirs, M files)) then collapsing the rest into a summary.
🤖 Generated with Claude Code
More specific example which motivated my issue/PR here:
edited -- version 1: rewritten, as to collapse those listed after if more than a limit
NB note that I am also looking for some option to handle those symlinks -- I do not care to list entire deref path.
The goal here -- given a collection of prototypical paths to be able to demonstrate overall structure of the filetree. Will be really handy to review structured filetree hierarchies like we have in https://bids.neuroimaging.io/ .