summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenji Nguyen <45523555+solidiquis@users.noreply.github.com>2023-07-01 11:28:28 +0700
committerGitHub <noreply@github.com>2023-07-01 11:28:28 +0700
commitdb45207b6bec7531e1034547a80d962b14f42f56 (patch)
tree4175e8e9b0f0fb10515d8f25614a3f0d88f024d8
parentebf2dfcf4facb02f84ad204c530e228bf488e83e (diff)
parent7c191548ec669e08f74b3eaf0f9887ce18b9394d (diff)
Merge pull request #202 from solidiquis/v3.1
V3.1
-rw-r--r--CHANGELOG.md86
-rw-r--r--Cargo.lock334
-rw-r--r--Cargo.toml6
-rw-r--r--README.md135
-rw-r--r--example/.erdtree.toml28
-rw-r--r--example/.erdtreerc9
-rw-r--r--rustfmt.toml1
-rw-r--r--src/context/args.rs136
-rw-r--r--src/context/color.rs10
-rw-r--r--src/context/config/mod.rs22
-rw-r--r--src/context/config/rc.rs (renamed from src/context/config.rs)60
-rw-r--r--src/context/config/toml/error.rs19
-rw-r--r--src/context/config/toml/mod.rs223
-rw-r--r--src/context/config/toml/test.rs91
-rw-r--r--src/context/error.rs26
-rw-r--r--src/context/layout.rs5
-rw-r--r--src/context/mod.rs139
-rw-r--r--src/context/test.rs37
-rw-r--r--src/context/time.rs9
-rw-r--r--src/disk_usage/file_size/byte.rs4
-rw-r--r--src/icons/fs.rs2
-rw-r--r--src/main.rs85
-rw-r--r--src/progress.rs95
-rw-r--r--src/render/grid/cell.rs32
-rw-r--r--src/render/layout/flat_inverted.rs44
-rw-r--r--src/render/layout/mod.rs3
-rw-r--r--src/render/layout/regular.rs2
-rw-r--r--src/render/long/mod.rs16
-rw-r--r--src/render/mod.rs3
-rw-r--r--src/tree/error.rs5
-rw-r--r--src/tree/mod.rs30
-rw-r--r--src/tree/node/cmp.rs4
-rw-r--r--src/tree/node/mod.rs12
-rw-r--r--src/tree/visitor.rs6
-rw-r--r--src/tty/mod.rs8
-rw-r--r--src/utils.rs15
-rw-r--r--tests/data/.erdtreerc3
37 files changed, 1409 insertions, 336 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fcc74d9..2470c2e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,93 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
+## [3.1.0] - 2023-07-01
+
+### [What's new](https://github.com/solidiquis/erdtree/pull/202)
+- [Multiple configs with .erdtree.toml](https://github.com/solidiquis/erdtree/pull/201)
+- [Increased performance with --suppress-size](https://github.com/solidiquis/erdtree/pull/203)
+- [-x, --one-file-system](https://github.com/solidiquis/erdtree/pull/204)
+- [Support for NO_COLOR](https://github.com/solidiquis/erdtree/pull/205)
+- [Inverted flat layout](https://github.com/solidiquis/erdtree/pull/206)
+- [Aliases: atime, ctime, and mtime](https://github.com/solidiquis/erdtree/pull/207)
+- [ctrlc handler to restore cursor if progress indicator is enabled](https://github.com/solidiquis/erdtree/pull/210)
+
+
+### [.erdtree.toml](https://github.com/solidiquis/erdtree/pull/201)
+
+First and foremost:
+
+**`.erdtreerc` is planned for deprecation by v3.3 so please migrate to `.erdtree.toml` by then.**
+
+There is now support for multiple configs:
+
+```
+-c, --config <CONFIG> Use configuration of named table rather than the top-level table in .erdtree.toml
+```
+
+So given the following example `.erdtree.toml`:
+
+```toml
+icons = true
+human = true
+
+# Compute file sizes like `du`
+[du]
+disk_usage = "block"
+icons = true
+layout = "flat"
+no-ignore = true
+no-git = true
+hidden = true
+level = 1
+
+# Do as `ls -l`
+[ls]
+icons = true
+human = true
+level = 1
+suppress-size = true
+long = true
+no-ignore = true
+hidden = true
+
+# How many lines of Rust are in this code base?
+[rs]
+disk-usage = "line"
+level = 1
+pattern = "\\.rs$"
+```
+
+```
+$ erd
+
+# equivalant to
+
+$ erd --human --icons
+```
+
+...
+
+```
+$ erd -c ls
+
+# equivalent to
+
+$ erd --icons --human --level 1 --suppress-size --long --no-ignore --hidden
+```
+
+etc.
+
+For further information on how to get started with the new `.erdtree.toml` please refer to the [README.md](README.md#toml-file).
+
+**NOTE**:
+- Multiple configs are only supported via `.erdtree.toml`.
+- If you have both a `.erdtree.toml` and `.erdtreerc` then the latter will take precedent. Attempts to use `--config` in said case will result in an error and a warning asking to migrate from `.erdtreerc` to `.erdtree.toml`.
+- Again: **`.erdtreerc` will be deprecated in favor of `.erdtree.toml` by v3.3**
+
+
## [3.0.2] - 2023-06-12
+- Added support for `.erdtree.toml`
### Bug fixes
- [Fixed segmentation fault that occurs with `--long` when file has an invalid user or group](https://github.com/solidiquis/erdtree/pull/193)
diff --git a/Cargo.lock b/Cargo.lock
index efe1064..0a6947e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3,6 +3,17 @@
version = 3
[[package]]
+name = "ahash"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
+dependencies = [
+ "getrandom",
+ "once_cell",
+ "version_check",
+]
+
+[[package]]
name = "aho-corasick"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -36,18 +47,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
+name = "async-trait"
+version = "0.1.68"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.10",
+]
+
+[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
+name = "base64"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
+
+[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
name = "bstr"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -147,12 +184,40 @@ dependencies = [
]
[[package]]
+name = "config"
+version = "0.13.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7"
+dependencies = [
+ "async-trait",
+ "json5",
+ "lazy_static",
+ "nom",
+ "pathdiff",
+ "ron",
+ "rust-ini",
+ "serde",
+ "serde_json",
+ "toml",
+ "yaml-rust",
+]
+
+[[package]]
name = "core-foundation-sys"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
+name = "cpufeatures"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c"
+dependencies = [
+ "libc",
+]
+
+[[package]]
name = "crossterm"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -178,6 +243,26 @@ dependencies = [
]
[[package]]
+name = "crypto-common"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
+dependencies = [
+ "generic-array",
+ "typenum",
+]
+
+[[package]]
+name = "ctrlc"
+version = "3.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a011bbe2c35ce9c1f143b7af6f94f29a167beb4cd1d29e6740ce836f723120e"
+dependencies = [
+ "nix",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
name = "cxx"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -222,6 +307,16 @@ dependencies = [
]
[[package]]
+name = "digest"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+dependencies = [
+ "block-buffer",
+ "crypto-common",
+]
+
+[[package]]
name = "dirs"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -242,14 +337,22 @@ dependencies = [
]
[[package]]
+name = "dlv-list"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
+
+[[package]]
name = "erdtree"
-version = "3.0.2"
+version = "3.1.0"
dependencies = [
"ansi_term",
"chrono",
"clap",
"clap_complete",
+ "config",
"crossterm",
+ "ctrlc",
"dirs",
"errno 0.3.1",
"filesize",
@@ -323,6 +426,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
+name = "generic-array"
+version = "0.14.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
+[[package]]
name = "getrandom"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -347,6 +460,15 @@ dependencies = [
]
[[package]]
+name = "hashbrown"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+dependencies = [
+ "ahash",
+]
+
+[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -444,6 +566,12 @@ dependencies = [
]
[[package]]
+name = "itoa"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
+
+[[package]]
name = "js-sys"
version = "0.3.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -453,6 +581,17 @@ dependencies = [
]
[[package]]
+name = "json5"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1"
+dependencies = [
+ "pest",
+ "pest_derive",
+ "serde",
+]
+
+[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -474,6 +613,12 @@ dependencies = [
]
[[package]]
+name = "linked-hash-map"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
+
+[[package]]
name = "linux-raw-sys"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -521,6 +666,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
+name = "minimal-lexical"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+
+[[package]]
name = "mio"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -533,6 +684,28 @@ dependencies = [
]
[[package]]
+name = "nix"
+version = "0.26.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
+dependencies = [
+ "bitflags",
+ "cfg-if",
+ "libc",
+ "static_assertions",
+]
+
+[[package]]
+name = "nom"
+version = "7.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
+dependencies = [
+ "memchr",
+ "minimal-lexical",
+]
+
+[[package]]
name = "nu-ansi-term"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -568,6 +741,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
+name = "ordered-multimap"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a"
+dependencies = [
+ "dlv-list",
+ "hashbrown",
+]
+
+[[package]]
name = "os_str_bytes"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -603,6 +786,56 @@ dependencies = [
]
[[package]]
+name = "pathdiff"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
+
+[[package]]
+name = "pest"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16833386b02953ca926d19f64af613b9bf742c48dcd5e09b32fbfc9740bf84e2"
+dependencies = [
+ "thiserror",
+ "ucd-trie",
+]
+
+[[package]]
+name = "pest_derive"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7763190f9406839f99e5197afee8c9e759969f7dbfa40ad3b8dbee8757b745b5"
+dependencies = [
+ "pest",
+ "pest_generator",
+]
+
+[[package]]
+name = "pest_generator"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "249061b22e99973da1f5f5f1410284419e283bb60b79255bf5f42a94b66a2e00"
+dependencies = [
+ "pest",
+ "pest_meta",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.10",
+]
+
+[[package]]
+name = "pest_meta"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "457c310cfc9cf3f22bc58901cc7f0d3410ac5d6298e432a4f9a6138565cb6df6"
+dependencies = [
+ "once_cell",
+ "pest",
+ "sha2",
+]
+
+[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -682,6 +915,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]]
+name = "ron"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a"
+dependencies = [
+ "base64",
+ "bitflags",
+ "serde",
+]
+
+[[package]]
+name = "rust-ini"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"
+dependencies = [
+ "cfg-if",
+ "ordered-multimap",
+]
+
+[[package]]
name = "rustix"
version = "0.36.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -710,6 +964,12 @@ dependencies = [
]
[[package]]
+name = "ryu"
+version = "1.0.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
+
+[[package]]
name = "same-file"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -735,6 +995,42 @@ name = "serde"
version = "1.0.156"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.156"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.97"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "sha2"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
[[package]]
name = "signal-hook"
@@ -773,6 +1069,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
+name = "static_assertions"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+
+[[package]]
name = "strip-ansi-escapes"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -873,6 +1175,27 @@ dependencies = [
]
[[package]]
+name = "toml"
+version = "0.5.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "typenum"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
+
+[[package]]
+name = "ucd-trie"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
+
+[[package]]
name = "unicode-ident"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1179,3 +1502,12 @@ name = "windows_x86_64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
+
+[[package]]
+name = "yaml-rust"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
+dependencies = [
+ "linked-hash-map",
+]
diff --git a/Cargo.toml b/Cargo.toml
index c6eb1e4..8f4d287 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "erdtree"
-version = "3.0.2"
+version = "3.1.0"
edition = "2021"
authors = ["Benjamin Nguyen <benjamin.van.nguyen@gmail.com>"]
description = """
@@ -12,7 +12,7 @@ documentation = "https://github.com/solidiquis/erdtree"
homepage = "https://github.com/solidiquis/erdtree"
repository = "https://github.com/solidiquis/erdtree"
keywords = ["tree", "find", "ls", "du", "commandline"]
-exclude = ["assets/*", "scripts/*"]
+exclude = ["assets/*", "scripts/*", "example/*"]
readme = "README.md"
license = "MIT"
rust-version = "1.70.0"
@@ -28,7 +28,9 @@ ansi_term = "0.12.1"
chrono = "0.4.24"
clap = { version = "4.1.1", features = ["derive"] }
clap_complete = "4.1.1"
+config = { version = "0.13.3", features = ["toml"] }
crossterm = "0.26.1"
+ctrlc = "3.4.0"
dirs = "5.0"
errno = "0.3.1"
filesize = "0.2.0"
diff --git a/README.md b/README.md
index a37e6fb..48d4d30 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,8 @@ You can think of `erdtree` as a little bit of `du`, `tree`, `find`, `wc` and `ls
* [Installation](#installation)
* [Documentation](#documentation)
- [Configuration file](#configuration-file)
+ - [Toml file](#toml-file)
+ - [.erdtreerc](#erdtreerc)
- [Hardlinks](#hardlinks)
- [Symlinks](#symlinks)
- [Disk usage](#disk-usage)
@@ -48,6 +50,7 @@ You can think of `erdtree` as a little bit of `du`, `tree`, `find`, `wc` and `ls
- [Redirecting output and colorization](#redirecting-output-and-colorization)
- [Parallelism](#parallelism)
- [Completions](#completions)
+ - [Same filesystem](#same-filesystem)
* [Comparisons against similar programs](#comparisons-against-similar-programs)
- [exa](#exa)
- [dua](#dua)
@@ -70,6 +73,9 @@ Arguments:
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
@@ -128,9 +134,9 @@ Options:
Which kind of timestamp to use; modified by default
Possible values:
- - create: Timestamp showing when the file was created
- - access: Timestamp showing when the file was last accessed
- - mod: Timestamp showing when the file was last modified
+ - 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
@@ -198,7 +204,7 @@ Options:
-T, --threads <THREADS>
Number of threads to use
- [default: 3]
+ [default: 10]
-u, --unit <UNIT>
Report disk usage in binary or SI units
@@ -209,6 +215,9 @@ Options:
- 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
@@ -218,6 +227,7 @@ Options:
- 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
@@ -316,6 +326,82 @@ 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.
+
+#### TOML file
+
+`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](example/.erdtree.toml) and below is an example of a valid `.erdtree.toml`:
+
+```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:
+1. `.erdtree.toml` only accepts long-named arguments without the preceding "--".
+2. 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.
+3. `snake_case` and `kebap-case` works.
+
+#### .erdtreerc
+
`erdtree` will look for a configuration file in any of the following locations:
On Linux/Mac/Unix-like:
@@ -333,24 +419,11 @@ 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` take precedence. If you have a config that you would like to ignore without deleting you can use `--no-config`.
+Arguments passed to `erdtree` on the command-line will override those found in `.erdtreerc`.
-Here is an example of a valid configuration file:
-
-```
-# Long argument
---icons
---human
+[Click here](example/.erdtreerc) for an example `.erdtreerc`.
-# or short argument
--l
-
-# args can be passed like this
--d logical
-
-# or like this
---unit=si
-```
+**If you have a config that you would like to ignore without deleting you can use `--no-config`.**
### Hardlinks
@@ -453,7 +526,7 @@ Additionally, the word and line-count of directories are the summation of all of
### Layouts
-`erdtree` comes with three layouts:
+`erdtree` comes with four layouts:
```
-y, --layout <LAYOUT>
@@ -465,6 +538,7 @@ Additionally, the word and line-count of directories are the summation of all of
- 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 traditional `tree`-like layout where the root node is at the very top of the output.
@@ -602,13 +676,13 @@ Currently only available on Unix-like platforms. Support for Windows is planned.
--octal
Show permissions in numeric octal format instead of symbolic
- --time <TIME>
+ --time <TIME>
Which kind of timestamp to use; modified by default
Possible values:
- - create: Timestamp showing when the file was created
- - access: Timestamp showing when the file was last accessed
- - mod: Timestamp showing when the file was last modified
+ - create: Time created (alias: ctime)
+ - access: Time last accessed (alias: atime)
+