erdtree
is a modern, cross-platform, multi-threaded, and general purpose filesystem and disk-usage utility that is aware of .gitignore
and hidden file rules.
The following are some feature highlights:
- Reports disk usage using a variety of metrics: bytes (logical or physical), blocks (Unix-only), word-count, or line-count.
- Supports an
ls -l
-like view with information about owners, group, file permission, etc. (Unix-only). - Respects hidden file and gitignore rules by default.
- Supports regular expressions and glob based searching by file-type.
- Comes with several layouts: a reverse tree output, a
tree
-like output, or adu
-like output. - Granular sorting capabilities.
- Supports icons.
- Colorized with
LS_COLORS
.
You can think of erdtree
as a little bit of du
, tree
, find
, wc
and ls
.
- Usage
- Installation
- Documentation
- Comparisons against similar programs
- Rules for contributing
- Security policy
- Questions you might have
$ erd --help
erdtree (erd) is a cross-platform, multi-threaded, and general purpose filesystem and disk usage utility.
Usage: erd [OPTIONS] [DIR]
Arguments:
[DIR]
Directory to traverse; defaults to current working directory
Options:
-c, --config <CONFIG>
Use configuration of named table rather than the top-level table in .erdtree.toml
-C, --color <COLOR>
Mode of coloring output
[default: auto]
Possible values:
- none: Print plainly without ANSI escapes
- auto: Attempt to colorize output
- force: Turn on colorization always
-d, --disk-usage <DISK_USAGE>
Print physical or logical file size
[default: physical]
Possible values:
- logical:
How many bytes does a file contain
- physical:
How many actual bytes on disk, taking into account blocks, sparse files, and compression
- line:
How many total lines a file contains
- word:
How many total words a file contains
- block:
How many blocks are allocated to store the file
-f, --follow
Follow symlinks
-H, --human
Print disk usage in human-readable format
-i, --no-ignore
Do not respect .gitignore files
-I, --icons
Display file icons
-l, --long
Show extended metadata and attributes
--group
Show file's groups
--ino
Show each file's ino
--nlink
Show the total number of hardlinks to the underlying inode
--octal
Show permissions in numeric octal format instead of symbolic
--time <TIME>
Which kind of timestamp to use; modified by default
Possible values:
- create: Time created (alias: ctime)
- access: Time last accessed (alias: atime)
- mod: Time last modified (alias: mtime)
--time-format <TIME_FORMAT>
Which format to use for the timestamp; default by default
Possible values:
- iso:
Timestamp formatted following the iso8601, with slight differences and the time-zone omitted
- iso-strict:
Timestamp formatted following the exact iso8601 specifications
- short:
Timestamp only shows date without time in YYYY-MM-DD format
- default:
Timestamp is shown in DD MMM HH:MM format
-L, --level <NUM>
Maximum depth to display
-p, --pattern <PATTERN>
Regular expression (or glob if '--glob' or '--iglob' is used) used to match files
--glob
Enables glob based searching
--iglob
Enables case-insensitive glob based searching
-t, --file-type <FILE_TYPE>
Restrict regex or glob search to a particular file-type
Possible values:
- file: A regular file
- dir: A directory
- link: A symlink
-P, --prune
Remove empty directories from output
-s, --sort <SORT>
How to sort entries
[default: size]
Possible values:
- name: Sort entries by file name in lexicographical order
- rname: Sort entries by file name in reversed lexicographical order
- size: Sort entries by size smallest to largest, top to bottom
- rsize: Sort entries by size largest to smallest, bottom to top
- access: Sort entries by newer to older Accessing Date
- raccess: Sort entries by older to newer Accessing Date
- create: Sort entries by newer to older Creation Date
- rcreate: Sort entries by older to newer Creation Date
- mod: Sort entries by newer to older Alteration Date
- rmod: Sort entries by older to newer Alteration Date
--dir-order <DIR_ORDER>
Sort directories before or after all other file types
[default: none]
Possible values:
- none: Directories are ordered as if they were regular nodes
- first: Sort directories above files
- last: Sort directories below files
-T, --threads <THREADS>
Number of threads to use
[default: 10]
-u, --unit <UNIT>
Report disk usage in binary or SI units
[default: bin]
Possible values:
- bin: Displays disk usage using binary prefixes
- si: Displays disk usage using SI prefixes
-x, --one-file-system
Prevent traversal into directories that are on different filesystems
-y, --layout <LAYOUT>
Which kind of layout to use when rendering the output
[default: regular]
Possible values:
- regular: Outputs the tree with the root node at the bottom of the output
- inverted: Outputs the tree with the root node at the top of the output
- flat: Outputs a flat layout using paths rather than an ASCII tree
- iflat: Outputs an inverted flat layout with the root at the top of the output
-., --hidden
Show hidden files
--no-git
Disable traversal of .git directory when traversing hidden files
--completions <COMPLETIONS>
Print completions for a given shell to stdout
[possible values: bash, elvish, fish, powershell, zsh]
--dirs-only
Only print directories
--no-config
Don't read configuration file
--no-progress
Hides the progress indicator
--suppress-size
Omit disk usage from output
--truncate
Truncate output to fit terminal emulator window
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
-l, --long
and all of its arguments are currently not available on Windows, but support for a Windows variant is planned.
Make sure you have Rust and its toolchain installed.
$ cargo install erdtree
The Windows version relies on some experimental features in order to properly support hard-link detection. If you want to build from crates.io
you'll first need to install the nightly toolchain before installing erdtree
:
$ rustup toolchain install nightly-2023-06-11
Thereafter:
$ cargo +nightly-2023-06-11 install erdtree
$ brew install erdtree
$ scoop install erdtree
$ pkgin install erdtree
Binaries for common architectures can be downloaded from latest releases.
If you'd like the latest features that are on master
but aren't yet included as part of a release:
$ cargo install --git https://github.com/solidiquis/erdtree --branch master
Other means of installation to come.
If erdtree
's out-of-the-box defaults don't meet your specific requirements, you can set your own defaults using a configuration file.
The configuration file currently comes in two flavors: .erdtreerc
(to be deprecated) and .erdtree.toml
. If you have both,
.erdtreerc
will take precedent and .erdtree.toml
will be disregarded, but please note that .erdtreerc
will be deprecated in the near future. There is
no reason to have both.
erdtree
will look for .erdtree.toml
in any of the following locations:
On Unix-systems:
$ERDTREE_TOML_PATH
$XDG_CONFIG_HOME/erdtree/.erdtree.toml
$XDG_CONFIG_HOME/.erdtree.toml
$HOME/.config/erdtree/.erdtree.toml
$HOME/.erdtree.toml
On Windows:
%APPDATA%\erdtree\.erdtree.toml
Here and below is an example of a valid .erdtree.toml
:
icons = true
human = true
# Compute file sizes like `du`
# e.g. `erd --config du`
[du]
disk_usage = "block"
icons = true
layout = "flat"
no-ignore = true
no-git = true
hidden = true
level = 1
# Do as `ls -l`
# e.g. `erd --config ls`
[ls]
icons = true
human = true
level = 1
suppress-size = true
long = true
# How many lines of Rust are in this code base?
# e.g. `erd --config rs`
[rs]
disk-usage = "line"
level = 1
pattern = "\\.rs$"
.erdtree.toml
supports multiple configurations. The top-level table is the main config that will be applied without additional arguments.
If you wish to use a separate configuration, create a named table like du
above, set your arguments, and invoke it like so:
$ erd --config du
# equivalent to
$ erd --disk-usage block --icons --layout flat --no-ignore --no-git --hidden --level 1
As far as the arguments go there are only three rules you need to be aware of:
.erdtree.toml
only accepts long-named arguments without the preceding "--".- Types are enforced, so numbers are expected to be numbers, booleans are expected to be booleans, strings are expected to be strings, and so on and so forth.
snake_case
andkebap-case
works.
erdtree
will look for a configuration file in any of the following locations:
On Linux/Mac/Unix-like:
$ERDTREE_CONFIG_PATH
$XDG_CONFIG_HOME/erdtree/.erdtreerc
$XDG_CONFIG_HOME/.erdtreerc
$HOME/.config/erdtree/.erdtreerc
$HOME/.erdtreerc
On Windows:
$ERDTREE_CONFIG_PATH
%APPDATA%\erdtree\.erdtreerc
The format of a config file is as follows:
- Every line is an
erdtree
option/argument. - Lines starting with
#
are considered comments and are thus ignored.
Arguments passed to erdtree
on the command-line will override those found in .erdtreerc
.
Click here for an example .erdtreerc
.
If you have a config that you would like to ignore without deleting you can use --no-config
.
If multiple hardlinks that point to the same inode are in the same file-tree, all will be included in the output but only one is considered when computing overall disk usage.
-f, --follow
Follow symlinks
Symlinks when followed will have their targets (and descendants) counted towards total disk usage, otherwise the size of the symlink itself will be reported. If a symlink's target happens to be in the same file-tree as the symlink itself, the target and its descendants will not be double-counted towards the total disk-usage. When a symlink to a directory is followed all of the box-drawing characters of its descendants will be painted in a different color for better visual feedback:
By default disk usage is reported as the total amount of physical bytes stored on the disk. To get the human-readable form:
-H, --human
Print disk usage in human-readable format
When using the human-readable form, binary units (e.g. 1 KiB = 1024 B
) are reported by default. If you prefer SI units (1 KB = 1000 B
) you can use the following:
-u, --unit <UNIT>
Report disk usage in binary or SI units
[default: bin]
Possible values:
- bin: Displays disk usage using binary prefixes
- si: Displays disk usage using SI prefixes
Additionally, various other disk usage metrics may be used instead of physical bytes. You have the following metrics available:
-d, --disk-usage <DISK_USAGE>
Print physical or logical file size
[default: physical]
Possible values:
- logical:
How many bytes does a file contain
- physical:
How many actual bytes on disk, taking into account blocks, sparse files, and compression
- line:
How many total lines a file contains
- word:
How many total words a file contains
- block:
How many blocks are allocated to store the file
Lastly, if you'd like to omit disk usage from the output:
--suppress-size
Omit disk usage from output
Physical size takes into account compression, sparse files, and actual blocks allocated to a particular file. Logical size just reports the total number of bytes in a file.
If you want the same exact disk usage reporting as du
, you can do the following:
$ erd --layout flat --disk-usage block --no-ignore --hidden --level
or in short-hand
$ erd -y flat -d block -i -.
When opting to report disk usage in either word and line count, unlike wc
, erdtree
will make no attempt to count the amount of words or lines for files that cannot
be encoded as a UTF-8 string such as a JPEG file. For cases such as these the line or total word-count will just appear as empty.
Additionally, the word and line-count of directories are the summation of all of the line/word-counts of its descendents.
erdtree
comes with four layouts:
-y, --layout <LAYOUT>
Which kind of layout to use when rendering the output
[default: regular]
Possible values:
- regular: Outputs the tree with the root node at the bottom of the output
- inverted: Outputs the tree with the root node at the top of the output
- flat: Outputs a flat layout using paths rather than an ASCII tree
- iflat: Outputs an inverted flat layout with the root at the top of the output
- The
inverted
layout a more traditionaltree
-like layout where the root node is at the very top of the output. - The
regular
layout is a tree with the root node at the bottom of the output for quick information about total disk usage. - The
flat
layout is a tree-less output that more closely resemblesdu
.
-i, --no-ignore
Do not respect .gitignore files
.gitignore
is respected by default but can be disregarded with the above argument. .gitignore
rules are also respected on a per directory basis, so
every directory that is encountered during traversal that has a .gitignore
will also be considered.
If .gitignore
is respected any file that is ignored will not be included in the total disk usage.
Hidden files
-., --hidden
Show hidden files
--no-git
Disable traversal of .git directory when traversing hidden files
Hidden files ignored by default but can be included with -., --hidden
. If opting in to show hidden files .git
is included; to exclude
it use --no-git
.
If hidden files are ignored it will not be included in the total disk usage.
-I, --icons Display file icons
Icons are an opt-in feature because for icons to render properly it is required that the font you have hooked up to your terminal emulator contains the glyphs necessary to properly render icons.
If your icons look something like this:
this means that the font you are using doesn't include the relevant glyphs. To resolve this issue download a NerdFont and hook it up to your terminal emulator.
Directories are fully traversed by default. To limit the maximum depth:
-L, --level <NUM>
Maximum depth to display
Limiting the maximum depth to display will not affect the total disk usage report nor the file count report.
Sometimes empty directories may appear in the output. To remove them:
-P, --prune
Remove empty directories from output
Various sorting methods are provided:
-s, --sort <SORT>
How to sort entries
[default: size]
Possible values:
- name: Sort entries by file name in lexicographical order
- rname: Sort entries by file name in reversed lexicographical order
- size: Sort entries by size smallest to largest, top to bottom
- rsize: Sort entries by size largest to smallest, bottom to top
- access: Sort entries by newer to older Accessing Date
- raccess: Sort entries by older to newer Accessing Date
- create: Sort entries by newer to older Creation Date
- rcreate: Sort entries by older to newer Creation Date
- mod: Sort entries by newer to older Alteration Date
- rmod: Sort entries by older to newer Alteration Date
--dir-order <DIR_ORDER>
Sort directories before or after all other file types
[default: none]
Possible values:
- none: Directories are ordered as if they were regular nodes
- first: Sort directories above files
- last: Sort directories below files
--dir-order
and --sort
acan be used independently of each other.
You output only directories with:
--dirs-only
Only print directories
This will not affect total disk usage.
Currently only available on Unix-like platforms. Support for Windows is planned.
erdtree
supports an ls -l
like long-view:
-l, --long
Show extended metadata and attributes
--group
Show file's groups
--ino
Show each file's ino
--nlink
Show the total number of hardlinks to the underlying inode
--octal
Show permissions in numeric octal format instead of symbolic
--time <TIME>
Which kind of timestamp to use; modified by default
Possible values:
- create: Time created (alias: ctime)
- access: Time last accessed (alias: atime)
- mod: Time last modified (alias: mtime)
--time-format <TIME_FORMAT>
Which format to use for the timestamp; default by default
Possible values:
- iso:
Timestamp formatted following the iso8601, with slight differences and the time-zone omitted
- iso-strict:
Timestamp formatted following the exact iso8601 specifications
- short:
Timestamp only shows date without time in YYYY-MM-DD format
- default:
Timestamp is shown in DD MMM HH:MM format
By default the columns shown in the order of left to right are:
- permissions in symbolic notation
- The file owner
- The date the file was last modified (or created or last accessed)
Filtering for particular files using a regular expression or glob is supported using the following:
-p, --pattern <PATTERN>
Regular expression (or glob if '--glob' or '--iglob' is used) used to match files
--glob
Enables glob based searching
--iglob
Enables case-insensitive glob based searching
-t, --file-type <FILE_TYPE>
Restrict regex or glob search to a particular file-type
Possible values:
- file: A regular file
- dir: A directory
- link: A symlink
If --file-type
is not provided when filtering, regular files (file
) is the default.
Additionally, any file that is filtered out will be excluded from the total disk usage.
Lastly, when applying a regular expression or glob to directories, all of its descendents regardless of file-type will be included in the output.
If you wish to only show directories you may use --dirs-only
.
References:
In instances where the output does not fit the terminal emulator's window, the output itself may be rendered incoherently:
In these situations the following may be used:
--truncate
Truncate output to fit terminal emulator window
By default colorization of the output is enabled if stdout is found to be a tty. If the output is not a tty such in the case of redirection to a file or piping to another command then colorization is disabled.
If, however, the default behavior doesn't suit your needs you have control over the modes of colorization:
-C, --color <COLOR>
Mode of coloring output
[default: auto]
Possible values:
- none: Print plainly without ANSI escapes
- auto: Attempt to colorize output
- force: Turn on colorization always
erdtree
also supports NO_COLOR.
The amount of threads used by erdtree
can be adjusted with the following:
-T, --threads <THREADS> Number of threads to use [default: 3]
A common question that gets asked is how parallelism benefits disk reads when filesystem I/O is processed serially.
While this is true, parallelism still results in improved throughput due to the fact that disks have a queue depth
that, when saturated, allows requests to be processed in aggregate keeping the disk busy as opposed to having it wait on erdtree
to do CPU-bound processing
in between requests. Additionally these threads aren't just parallelizing disk reads, they're also parallelizing the processing of the retrieved data.
It should be noted however that performance, as a function of thread-count, is asymptotic in nature (see Amdahl's Law) so you'll quickly reach a point of dimishing returns after a certain thread-count threshold as you'd be paying the cost of managing a larger threadpool with no added benefit.
For empirical data on the subject checkout this article.
--completions
is used to generate auto-completions for common shells so that the tab
key can attempt to complete your command or give you hints; where you place the output highly depends on your shell as well as your setup. In my environment where I use zshell
with oh-my-zsh
, I would install completions like so:
$ erd --completions zsh > ~/.oh-my-zsh/completions/_erd
$ source ~/.zshrc
If you are traversing a directory that contains mount points to other filesystems that you do not wish to traverse, use the following:
-x, --one-file-system
Prevent traversal into directories that are on different filesystems
For rules on how to contribute please refer to CONTRIBUTING.md.
For information regarding erdtree
's security policy and how to report a security vulnerability please refer to SECURITY_POLICY.md
It goes without saying that the following programs are all amazing in their own right and were highly influential in erdtree
's development. While each of the following are highly
specialized in acting as modern replacements for their Unix progenitors, erdtree
aims to take bits and pieces of each that people use most frequently and assemble them into a unified highly practical tool.
No case will be made as to why erdtree
should be preferred over X, Y, or Z, but because of some notable similarities with the following programs it is worth a brief
comparison.
exa
and erdtree
are similar in that they both have tree-views and show information about permissions, owners, groups, etc..
The disadvantage of exa
, however, is that it does not provide information about the disk usages of directories, which
also makes sorting files by size a little dubious. The advantage exa
has over erdtree
, however, is in the fact that exa
is much more comprehensive as an ls
replacement.
Both tools are complimentary to one another and it is encouraged that you have both in your toolkit.
dua
is a fantastic interactive disk usage tool that serves as a modern alternative to
ncdu. If you're in the mood for something interactive and solely focused on disk usage then dua
might suit you more.
If you're interested in file permissions and doing quick static analysis of your disk usage without spinning up an entire interactive UI then perhaps consider erdtree
.
dust
is another fantastic tool that is closer in geneology to the traditional du
command. If you're strictly looking for
a modern replacement to du
then dust
is a great choice.
fd
is much more comprehensive as a general finder tool, offering itself as a modern replacement to find
. If you're looking for more granularity in your ability to search beyond just globbing, regular
expressions, and the three basic file types (files, directories, and symlinks) then fd
is the optimal choice.
Q: Why did you make this? It's totally unnecessary.
A: Ennui.
Q: Why is it called erdtree?
A: It's a reference to an object of worship in Elden Ring.
Q: Is it any good?
A: Yes.
Q: Why is there no mention of this project being blazingly fast or written in Rust? Is it slow or something?
A: Okay fine. erdtree
is written in Rust and is blazingly fast.
erdtree's People
Forkers
ayushashi11 mike-dax shnwang hengle lo-ferris vars1ty jprochazk yonasbsd allenli178 jedanny jellybobbin usrtax oxy-archive bwstearns bryceberger waltarix leizhenpeng hj3938 0xack13 waynekearns fawni xiuxiu62 psy-repos-rust jubalh brezak kjm0001 pake-actions cosmichorrordev daodaoliang klingtnet 1parmsingh goggle jhscheer gunsafighter roopeshsn knodis-c ailinuxok nocturnalglory knodis-c xpcom-bsd frischifrisch demilich1 obourdon iquiw torstenkuhn77 dimied whakapapa nwoythal pitbuster adamniederer knodis-c ulrichsg adam-frisby siqpush oxyhyxo nbhatta7 mikesmithgh koranir tomlonergan03 wangjianze davefogo analogiks skaarlcooper thainh9erdtree's Issues
[feature] binary prefixes
hello, thank you for making this program. i think it'd be a good idea for erdtree to support binary prefix, since other programs like du uses binary prefix as default like following:
$ du --help
...
--si like -h, but use powers of 1000 not 1024
As recommended in IEC 80000-13, this command will report sizes using SI units rather than binary units.
also, could you point me in the direction of source where it states SI unit is preferred over binary units?
Definition of prefixes using powers of 10βin which 1 kilobyte (symbol kB) is defined to equal 1,000 bytesβis recommended by the International Electrotechnical Commission (IEC)
i found relevent paragraph in byte, and it looks like it's for SI prefix using 1000 vs 1024, not that it's preferred to use SI unit over binary prefix.
brew doctor warns about erdtree (1.8.1) not having an associated brew formula?
brew doctor
Warning: Some installed kegs have no formulae!
This means they were either deleted or installed manually.
You should find replacements for the following formulae:
erdtree
Globbing prevents complete traversal which suppresses directory size
Ultimately the goal is to allow WalkParallel
to do a complete traversal so that we can get comprehensive information about disk usage. Globbing/filtering/ordering and the like should happen after the fact.
Regex may should be consider in the prefix exclustion
The -p options is used to exclude files or directories with some specified prefixes. But if some hidden or system files start with "." prefixes, they can't be ignored.
I guessed the match didn't use Regex?
[... tensorflow]$ erdtree -l 1 -p "."
. (228.41 MB)
ββ CODE_OF_CONDUCT.md (5.37 KB)
ββ .pylintrc (0 B)
ββ .bazelversion (6 B)
ββ tools (4.91 KB)
ββ arm_compiler.BUILD (1.18 KB)
ββ configure.py (53.52 KB)
ββ LICENSE (15.50 KB)
ββ configure (285 B)
error: unexpected argument '--dir' found
config file: ~/.erdtreerc
, as follow:
--level 1
--icons
--scale 3
-s size
--dirs-first
run: et SomeDir
error occured:
error: unexpected argument '--dir' found
note: argument '--dirs-first' exists
Once I delete the .erdtreerc
file, and run the equivalent command: et -l 1 --icons --scale 3 -s size --dirs-first SomeDir
, everything works fine.
Feature request: Add flags for providing owners and permission
Hey mate,
First of all. BLAZINGLY FASTTTT
Into my request. It would be great if we could add some feature to view who owns the file and what permission it was granted. So basically showing rwx permission
[feature] could one switch be added to suspress the size?
Sometimes, I only want the directory hierarchy and put them in one documentation. The size doesn't make sense here.
hang with non-existant directories?
when given a directory that doesn't exist, erdtree seems to hang until it is terminated manually.
These are the last three lines displayed when running with strace
:
getcwd("/home/arisun/Projects/andrea", 1024) = 29
readlink("/home/arisun/Projects/andrea/bogus", 0x7ffec44b6d50, 1023) = -1 ENOENT (No such file or directory)
futex(0x56497ab84a58, FUTEX_WAIT_BITSET_PRIVATE, 4294967295, NULL, FUTEX_BITSET_MATCH_ANY
I am running the latest release, 1.7.0 on Arch in case that matters
Add winget support
Now that winget is the official package manager for Windows, it would be useful to use winget since it's already pre-installed for Windows machines.
Feature request: make erdtree consume input from pipe
Hi,
The glob option covers most cases but not all.
If i could use erdtree in combination with fd, the following would be possible
fd -e rs '^hel[lL]o' | et
Thanks for this great tool !!!
Config file should follow XDG specs
[Feature request:] Pruning (when filtering using glob, don't print the empty branches)
I really like erdtree, here is little idea that I came across while using erdtree to search for files on my disk.
As the title says, it would be useful to enable "pruning" so the output only contains branches that aren't empty at the end.
Example:
let's say we have directory:
ο folder_a
ββ ο folder_b
β ββ ο
file_d (0.00 B)
β ββ ο
file_c (0.00 B)
β ββ ο folder_ba
β β ββ ο
file_x (0.00 B)
β ββ ο folder_bc
β β ββ ο
file_z (0.00 B)
β ββ ο folder_bb
β ββ ο
file_y (0.00 B)
ββ ο
file_a (0.00 B)
ββ ο folder_c
β ββ ο
file_ab (0.00 B)
β ββ ο
file_ac (0.00 B)
β ββ ο
file_ad (0.00 B)
β ββ ο
file_f (0.00 B)
β ββ ο
file_e (0.00 B)
ββ ο
file_b (0.00 B)
and I want to filter for files that contains "a": et -g "file_*a*"
and the output is:
ο folder_a
ββ ο folder_b
β ββ ο folder_bc
β ββ ο folder_ba
β ββ ο folder_bb
ββ ο
file_a (0.00 B)
ββ ο folder_c
ββ ο
file_ab (0.00 B)
ββ ο
file_ac (0.00 B)
ββ ο
file_ad (0.00 B)
but with the "pruning" enabled, it would skip the "dead-ends" and print just:
ο folder_a
ββ ο
file_a (0.00 B)
ββ ο folder_c
ββ ο
file_ab (0.00 B)
ββ ο
file_ac (0.00 B)
ββ ο
file_ad (0.00 B)
The idea is that when searching through bigger trees, the dead-ends are cluttering the output.
Sort by filesize could be a good feature
The performance of this tools is great! Amazing~
If a sort option for this command can be added. It would be better. In many cases, we might want to find the largest file or directory. Sort function can save the time for users to check from top to button.
For example:
OPTIONS:
β¦β¦
-s: Sorted by file size
`--dirs-first` flag does nothing if no SortType is specified
for example: et --dirs-first
will not sort directories above files, but if sort type is specified: et --dirs-first -s name
it works as expected.
i was able to produce the expected behavior by adding a None
enum variant to SortType
and adding:
} else if ctx.dirs_first() {
Order::from((SortType::None, true))
.comparator()
.map(|func| current_node.sort_children(func));
}
to this line, but there are probably "cleaner" approaches.
also, i noticed that clippy suggests a bunch of stylistic refactors all over. do you have an opinion against such stylistic approaches?
Provide option to print without colors
I want to use erdtree
to print a project's folder structure and use it in README's, but the ANSI escape sequences make it unreadable.
Something like --no-colors
or --plain
would do the trick.
I'd be happy to work on this feature if that's alright.
Use LS_COLORS rather than arbitary colorscheme
Colorscheme for tree is arbitrary and hard-coded into the program; opt to use LS_COLORS
instead.
[Optimization] - Indextree
This might lead to better cache locality: https://docs.rs/indextree/latest/indextree/
`--ignore-git-ignore` in erdtreerc is ignored
To reproduce, put --ignore-git-ignore
in $HOME/.erdtreerc
.
Then run et
from a directory that has some gitignored files. They won't be printed.
For comparison, if the flag is supplied through command line: et --ignore-git-ignore
, it works as expected.
> et --version
erdtree 1.4.1
Publish to crates.io?
Hello!
This is a really fantastic tool. I was wondering if there's any hope of possibly publishing this to crates.io?
thread 'main' panicked; symlink issue?
The et
command works fine - except in my home directory:
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/fs/erdtree/node.rs:271:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The only difference I can see is that my home directory has links from other directories. Like this:
lrwxrwxrwx@ 19 dave dave 26 Feb 2022 Documents -> /foo/Documents
lrwxrwxrwx@ 16 dave dave 10 Jan 2022 Downloads -> /blah/Downloads
Any other ideas? Let me know if you require additional information. Using version 1.20.
Add support for installation via curl command
As a user, I would like to be able to install the erdtree CLI application using the curl command. This would allow me to easily download and install the application without having to download the binary file manually or other installation methods.
I would like to contribute to this feature by creating the installation script.
et crashes when --prune is combined with a non existing --glob
et
crashes when --prune
is combined with a non existing --glob
, e.g.:
$ cargo run -- --no-config --level 1 --prune --glob "main.rs" tests/data
Finished dev [unoptimized + debuginfo] target(s) in 0.05s
Running `target/debug/et --no-config --level 1 --prune --glob main.rs tests/data`
thread '<unnamed>' panicked at 'internal error: entered unreachable code: Try to access a freed node', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/indextree-4.6.0/src/node.rs:45:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', src/render/tree/mod.rs:156:24
Probably more efficient to have TreeNode's location field be a Path rather than a PathBuf
erdtree/src/file_tree/tree_node.rs
Line 40 in 09ff686
TreeNode is creating a new PathBuf
when it could probably just be a Path
which is an unsized type and therefore must always be borrowed.
Potential name clash
Line 145 in 89bd048
Hi, I noticed erdtree is in the AUR and I installed it. Works very well, congrats!
As long-time user and collaborator to the Firejail project it didn't take long before creating a firejail profile for erdtree. That profile also works quite well, but then I hit a snag. Apparently the spreadsheet component of WPS Office is also called (and installed as) et
.
Obviously that's not a problem for the erdtree dev(s) as such. I sure like short, easy to remember command names myself. Realizing what a name change of the binary entails, I don't want to suggest to do so. I just wanted to bring this to your attention.
BUG REPORT: et doesn't shows mp4 files
My et doesn't shows mp4 files
Version: erdtree 1.6.0
β― ls
'0001-FINAL [573011600].mp4' '0003-FINAL [573012721].mp4' lessons_links.txt
'0002-FINAL [573011998].mp4' '0004-FINAL [573013069].mp4' video_links.txt
β― et
00-intro (709 B)
ββ video_links.txt (328 B)
ββ lessons_links.txt (381 B)
[feature] Sort directories first
Γ la tree --dirsfirst
, an option to sort directories above normal files.
In my view, there are two ways to implement this:
et --sort dir
, a manually-implemented "sort by directory"et --sort ... --dirs-first
, an option for all sorting methods to sort directories first
I have both implemented, don't know which (if either) to make a pr for.
The Number of the Beast
Strange coloring issue on Windows Terminal + MSys2
`--ignore-git` doesn't seem to work
running et with hidden files and ignore git doesn't seem to work. I looked into it but I couldn't track it down fully yet (I'm still trying to grok OverrideBuilder
atm).
[bws:~/circadian_tools] avgday(+19/-0)+ Β± et -H --ignore-git
circadian_tools (220.02 KB)
ββ src (6.18 KB)
β ββ chrono.rs (2.01 KB)
β ββ lib.rs (4.18 KB)
ββ .git (197.54 KB)
β ββ FETCH_HEAD (96.00 B)
β ββ packed-refs (112.00 B)
β ββ refs (809.00 B)
β β ββ remotes (399.00 B)
β β β ββ origin (399.00 B)
β β β ββ tau (41.00 B)
β β β ββ main (41.00 B)
Maybe this code here is getting called before the show-hidden-glob gets added so it basically gets overwritten?
if self.ignore_git {
builder.add("!.git/**/*")?;
}
[Feature request] Displaying modification time
Hi!
I've been using erdtree for a bit of time now and I'm quite happy with it, thanks for making this tool :)
I have one request though: would it possible (don't if it is) to add an option to also display the modification time of elements? It'd very, very useful for me.
Currently I use fd ... -x ls -lhd
but it is quite slow, especially compared to erdtree
.
Want to add the build-time Rust version to the README
`--sort size` in .erdtreerc has no effect
-H not ignore './git/*'
as title
Windows build is missing from the v1.6.0 release page
Hi, I notice the Windows build is missing from the v1.6.0 release page.
After investigating, I found that an error occurred during the upload process of the Windows files in the Publish CI for the v1.6.0 release: https://github.com/solidiquis/erdtree/actions/runs/4466914178/jobs/7846464218#step:8:308
I think this might be the root cause of the issue.
Position command like argument doesn't work when a config file exists.
$ et some_dir
for example won't work if a configuration file exists.
Feature idea: files count
Idea: a flags that enables reporting total file count for directories,
Could be especially useful with #84, so you could report files count like
ββ a (123.45 MiB, 123 files)
β ββ b (67.89 MiB, 67 files)
ββ b (234.56 MiB, 234 files)
β ββ c (56.78 MiB, 56 files)
β ββ ββ d (8.90 MiB, 8 files)
This might be somewhat confusing because it's not the number of files in a given directory but rather total files in this directory and all subdirectories (but is otherwise consistent with total file size being reported recursively).
Feature idea: folders only
Use case: you have a small number (dozens) of folders, each of which may contain thousands of files. They may be at different depths, e.g.
a/{1k files}
a/b/{1k files}
b/c/d/{1k files}
in which case you might want a report like
ββ a (123.45 MiB)
β ββ b (67.89 MiB)
ββ b (234.56 MiB)
β ββ c (56.78 MiB)
β ββ ββ d (8.90 MiB)
For cases like this, would be real nice to have "dirs only" flags (e.g. -D / --dirs-only
).
Apologies in advance if this is already doable and I have missed it.
[feature] Add `args_override_self(true)`
Reasoning: I would like to make an alias to change some default behavior (sort, prefixes (future), etc). However, supplying the same argument twice (et -s name -s size
) is an error.
Current behavior: et -s name -s size
will not execute, with the message (from clap
) that --sort
cannot be used multiple times.
Expected behavior: et -s name -s size
will execute, and sort output by size.
(This is a 3 line change and I have a PR ready, just wanted approval first as stated in the readme)
Asset for windows wasn't released in v1.8.1
The asset for windows wasn't released in v1.8.1.
[feature] Option to filter files
It would be nice to be able to do:
$ erdtree --filter <glob_pattern>
$ erdtree -f <glob_pattern>
For example,
$ erdtree -f !*.snap
Would filter all insta snapshot files, and
$ erdtree -f *.snap
Would only display the snapshot files.
It seems like the ignore
crate already supports adding ignore overrides.
Would you accept a PR that implements this?
v1.3.0 is unable to build from source on windows via cargo install+ crates.io with rust 1.67.1 stable
Hello!
Thanks for continuing to improve this tool It's one of my favorites π
After trying to upgrade to erdtree
1.3.0 with cargo install
via crates.io, I got the following error output (placed inside a <details>
block for brevity, with truncated path)
error[E0425]: cannot find value `metadata` in this scope
--> ${HOME}\.cargo\registry\src\github.com-1ecc6299db9ec823\erdtree-1.3.0\src\fs\inode.rs:54:13
|
54 | metadata.file_index(),
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
1 | use core::ptr::metadata;
|
1 | use std::fs::metadata;
|
1 | use std::ptr::metadata;
|
error[E0425]: cannot find value `metadata` in this scope
--> ${HOME}\.cargo\registry\src\github.com-1ecc6299db9ec823\erdtree-1.3.0\src\fs\inode.rs:55:13
|
55 | metadata.volume_serial_number(),
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
1 | use core::ptr::metadata;
|
1 | use std::fs::metadata;
|
1 | use std::ptr::metadata;
|
error[E0425]: cannot find value `metadata` in this scope
--> ${HOME}\.cargo\registry\src\github.com-1ecc6299db9ec823\erdtree-1.3.0\src\fs\inode.rs:56:13
|
56 | metadata.number_of_links(),
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
1 | use core::ptr::metadata;
|
1 | use std::fs::metadata;
|
1 | use std::ptr::metadata;
|
error[E0425]: cannot find value `nlink` in this scope
--> ${HOME}\.cargo\registry\src\github.com-1ecc6299db9ec823\erdtree-1.3.0\src\fs\inode.rs:58:42
|
58 | return Ok(Self::new(md, dev, nlink));
| ^^^^^
| |
| a field by this name exists in `Self`
| help: a local variable with a similar name exists: `nlinks`
error[E0308]: mismatched types
--> ${HOME}\.cargo\registry\src\github.com-1ecc6299db9ec823\erdtree-1.3.0\src\fs\inode.rs:58:33
|
58 | return Ok(Self::new(md, dev, nlink));
| --------- ^^ expected `u64`, found struct `Metadata`
| |
| arguments to this function are incorrect
|
note: associated function defined here
--> ${HOME}\.cargo\registry\src\github.com-1ecc6299db9ec823\erdtree-1.3.0\src\fs\inode.rs:18:12
|
18 | pub fn new(ino: u64, dev: u64, nlink: u64) -> Self {
| ^^^ --------
Some errors have detailed explanations: E0308, E0425.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `erdtree` due to 5 previous errors
error: failed to compile `erdtree v1.3.0`, intermediate artifacts can be found at `${HOME}\AppData\Local\Temp\cargo-installK25LHL`
To replicate this, I simply use cargo install erdtree
Does erdtree have a configuration file or environment variable?
I'm getting used to erdtree and liking what I'm seeing. I usually run it as et --icons
or et --icons --dirs-first
, etc.
So now I'm wondering: Is there some file or variable I can set that sets the "default" options for et
? That is, export ERDTREE=--icons ...
or an .erdtreerc
or .config/erdtree.toml
or such file where I could put in my "always show icons" options?
I know I can make an alias, but, well, if there's a more "canonical" way of doing this, I'd prefer that.
[FEATURE] use `-L` flag for level
In tree, -L
is used for specifying the depth of the tree. Currently -L
flag is not used by et, so can et use both -L
and -l
for the level to match the convention?
[feature] Add support for generating shell completions
There are 2 ways this could be done:
I've tried to implement both solutions and the build script solution would require changing how imports are done since just including the context module essentially means having to include almost the entire project module hierarchy.
Error when directory contains too much directories and files
$ erdtree -l 1
thread 'main' panicked at 'called Result::unwrap()
on an Err
value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/file_tree/tree_node.rs:48:51
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
--suppress-size still recursively computes file sizes even when sorting is disabled
I'm a simple man. I like pretty colors and file icons. So I installed this to replace tree and exa. I put up an alias to run et -i -I -s size -l 2
. all nice and pretty.
Then I tried running the command at my root directory with and realized that wait, this is a tool that was made to calculate disk usage, not just print pretty trees! It took longer than necessary to just print 2 layers of folders.
So I tried --suppress-size. Still, it took the same amount of time.
So then I thought this was using the size data to possibly sort the files. I checked the source code and, yeah, it holds the data until it tries to sort. But it would be niceβ’ with
struct Context {
// ...
#[arg(short, long)]
max_depth: Option<usize>,
}
impl Context {
// ...
fn max_depth(&self) -> usize {
self.max_depth.unwrap_or(usize::MAX)
}
fn walk_depth(&self) -> usize {
self.max_depth().max(self.level())
}
}
and a little bit of WalkBuilder::max_depth() in TryFrom<&Context> for WalkParallel then account for max_depth < level by setting the file sizes of deeper folders to 0 and hopefully done?
Now this should let you look at the shallow sizes of directories, if ever that's a thing that you need to do.
thread panics when called from root ('/') directory
I really like this program, just a (small?) issue I found:
when I do cd /
and then et
, I get this panic:
[tom@tom-pc ~]$ cd /
[tom@tom-pc /]$ et
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/tom/.cargo/registry/src/github.com-1ecc6299db9ec823/erdtree-1.2.0/src/fs/erdtree/node.rs:220:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', /home/tom/.cargo/registry/src/github.com-1ecc6299db9ec823/ignore-0.4.20/src/walk.rs:1302:31
^C
WSL2 & Google Drive Shared Drives
I'm using:
- WSL2
- Windows 11 Pro version 22H2
- Debian (Debian GNU/Linux 11 (bullseye))
- Erdtree v 1.7.1
- Google Drive (Windows application) version 72.0.3.0
Running erdtree in /mnt/g/Shared drives/$DRIVE appears to hang - I've outputted to a file and run tail on the file for 10 minutes and had no output. Seeing as there does not appear to be a verbose output, is there any other documentation you'd like?
fix config locations
i still do not understand what is the point of making $HOME more clutter to maintain, even when we try to make it Clean / Neat
issue is regarding config-location
$HOME/.erdtreerc
make location good , i mean standards of unix as `.config/et/.etrc'
some work around or TIPS which i have been using to tackle it
in Window (coz i use it for now ) :(
in $profile put this
$env:ERDTREE_CONFIG_PATH="path/to/conf/"
in Unix
in .bashrc
put
export ERDTREE_CONFIG_PATH=path
[Request] scoop manifest for window ?
i would really love if I can have
scoop manifest , so it would be easy to install on window
THX
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.