summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenji Nguyen <45523555+solidiquis@users.noreply.github.com>2024-05-19 11:05:31 -0700
committerGitHub <noreply@github.com>2024-05-19 11:05:31 -0700
commita31fa29577e2a2632608fb31bc66d9dd8f726b1e (patch)
tree9252c3c3880fc76101b7bbd0b2808dda249dfa9c
parent5e4da1367c640e2fffc13e11f36a4c9de3b14da0 (diff)
parent37bdf6b6ae6a3ece82ae035ad8cf6d14208142fa (diff)
Merge pull request #256 from solidiquis/progress-indicatorsolidiquis/traversal
Progress indicator
-rw-r--r--Cargo.lock311
-rw-r--r--Cargo.toml19
-rw-r--r--rustfmt.toml1
-rw-r--r--src/disk/mod.rs22
-rw-r--r--src/file/mod.rs54
-rw-r--r--src/file/tree/filter.rs10
-rw-r--r--src/file/tree/mod.rs94
-rw-r--r--src/file/tree/traverse.rs8
-rw-r--r--src/logging.rs44
-rw-r--r--src/main.rs79
-rw-r--r--src/perf.rs127
-rw-r--r--src/progress.rs164
-rw-r--r--src/render/mod.rs298
-rw-r--r--src/render/row/long.rs32
-rw-r--r--src/render/row/mod.rs6
-rw-r--r--src/user/config/parse.rs12
-rw-r--r--src/user/mod.rs23
17 files changed, 869 insertions, 435 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 505a964..510e150 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "ahash"
-version = "0.8.6"
+version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
+checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
"cfg-if",
"getrandom",
@@ -17,9 +17,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
-version = "0.7.20"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
@@ -44,15 +44,16 @@ dependencies = [
[[package]]
name = "anstream"
-version = "0.6.4"
+version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
+checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
+ "is_terminal_polyfill",
"utf8parse",
]
@@ -115,10 +116,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
+name = "bitflags"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
+
+[[package]]
name = "bstr"
-version = "1.3.0"
+version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1"
+checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706"
dependencies = [
"memchr",
"serde",
@@ -143,6 +150,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
+name = "cfg_aliases"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
+
+[[package]]
name = "chrono"
version = "0.4.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -156,9 +169,9 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.4.10"
+version = "4.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272"
+checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
dependencies = [
"clap_builder",
"clap_derive",
@@ -166,9 +179,9 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.4.9"
+version = "4.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1"
+checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
dependencies = [
"anstream",
"anstyle",
@@ -187,9 +200,9 @@ dependencies = [
[[package]]
name = "clap_derive"
-version = "4.4.7"
+version = "4.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
+checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
dependencies = [
"heck",
"proc-macro2",
@@ -199,9 +212,9 @@ dependencies = [
[[package]]
name = "clap_lex"
-version = "0.6.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
+checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
[[package]]
name = "colorchoice"
@@ -229,12 +242,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
+name = "crossbeam-deque"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
+dependencies = [
+ "crossbeam-epoch",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.9.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.8.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
+
+[[package]]
name = "crossterm"
-version = "0.26.1"
+version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
+checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
dependencies = [
- "bitflags",
+ "bitflags 2.5.0",
"crossterm_winapi",
"libc",
"mio",
@@ -246,21 +284,21 @@ dependencies = [
[[package]]
name = "crossterm_winapi"
-version = "0.9.0"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c"
+checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
dependencies = [
"winapi",
]
[[package]]
name = "ctrlc"
-version = "3.4.0"
+version = "3.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a011bbe2c35ce9c1f143b7af6f94f29a167beb4cd1d29e6740ce836f723120e"
+checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345"
dependencies = [
"nix",
- "windows-sys 0.48.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -309,7 +347,6 @@ dependencies = [
"indextree",
"indoc",
"libc",
- "log",
"lscolors",
"once_cell",
"regex",
@@ -372,12 +409,6 @@ dependencies = [
]
[[package]]
-name = "fnv"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-
-[[package]]
name = "getrandom"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -390,15 +421,15 @@ dependencies = [
[[package]]
name = "globset"
-version = "0.4.10"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
+checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"
dependencies = [
"aho-corasick",
"bstr",
- "fnv",
"log",
- "regex",
+ "regex-automata",
+ "regex-syntax",
]
[[package]]
@@ -409,9 +440,9 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "heck"
-version = "0.4.1"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
@@ -444,17 +475,16 @@ dependencies = [
[[package]]
name = "ignore"
-version = "0.4.20"
+version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
+checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1"
dependencies = [
+ "crossbeam-deque",
"globset",
- "lazy_static",
"log",
"memchr",
- "regex",
+ "regex-automata",
"same-file",
- "thread_local",
"walkdir",
"winapi-util",
]
@@ -502,6 +532,12 @@ dependencies = [
]
[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
+
+[[package]]
name = "js-sys"
version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -518,9 +554,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.141"
+version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
+checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "linux-raw-sys"
@@ -530,9 +566,9 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]]
name = "linux-raw-sys"
-version = "0.3.1"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
+checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "lock_api"
@@ -552,9 +588,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "lscolors"
-version = "0.13.0"
+version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2dedc85d67baf5327114fad78ab9418f8893b1121c17d5538dd11005ad1ddf2"
+checksum = "53304fff6ab1e597661eee37e42ea8c47a146fca280af902bb76bff8a896e523"
dependencies = [
"ansi_term",
"nu-ansi-term",
@@ -562,9 +598,9 @@ dependencies = [
[[package]]
name = "memchr"
-version = "2.5.0"
+version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
+checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "minimal-lexical"
@@ -586,14 +622,14 @@ dependencies = [
[[package]]
name = "nix"
-version = "0.26.2"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
+checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
- "bitflags",
+ "bitflags 2.5.0",
"cfg-if",
+ "cfg_aliases",
"libc",
- "static_assertions",
]
[[package]]
@@ -608,12 +644,11 @@ dependencies = [
[[package]]
name = "nu-ansi-term"
-version = "0.46.0"
+version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+checksum = "dd2800e1520bdc966782168a627aa5d1ad92e33b984bf7c7615d31280c83ff14"
dependencies = [
- "overload",
- "winapi",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -637,15 +672,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.17.1"
+version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
-
-[[package]]
-name = "overload"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "parking_lot"
@@ -700,7 +729,7 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
]
[[package]]
@@ -716,9 +745,21 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.7.3"
+version = "1.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
+checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
@@ -727,9 +768,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.6.29"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
+checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "rustix"
@@ -737,7 +778,7 @@ version = "0.36.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"errno 0.2.8",
"io-lifetimes",
"libc",
@@ -747,16 +788,15 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.37.7"
+version = "0.38.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d"
+checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e"
dependencies = [
- "bitflags",
+ "bitflags 2.5.0",
"errno 0.3.1",
- "io-lifetimes",
"libc",
- "linux-raw-sys 0.3.1",
- "windows-sys 0.45.0",
+ "linux-raw-sys 0.4.14",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -805,9 +845,9 @@ dependencies = [
[[package]]
name = "signal-hook"
-version = "0.3.15"
+version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9"
+checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801"
dependencies = [
"libc",
"signal-hook-registry",
@@ -840,12 +880,6 @@ 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"
@@ -856,9 +890,9 @@ dependencies = [
[[package]]
name = "strsim"
-version = "0.10.0"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
@@ -886,11 +920,11 @@ dependencies = [
[[package]]
name = "terminal_size"
-version = "0.2.6"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237"
+checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7"
dependencies = [
- "rustix 0.37.7",
+ "rustix 0.38.25",
"windows-sys 0.48.0",
]
@@ -915,16 +949,6 @@ dependencies = [
]
[[package]]
-name = "thread_local"
-version = "1.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
-dependencies = [
- "cfg-if",
- "once_cell",
-]
-
-[[package]]
name = "toml"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -999,9 +1023,9 @@ dependencies = [
[[package]]
name = "walkdir"
-version = "2.3.3"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
dependencies = [
"same-file",
"winapi-util",
@@ -1141,6 +1165,15 @@ dependencies = [
]
[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.5",
+]
+
+[[package]]
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1171,6 +1204,22 @@ dependencies = [
]
[[package]]
+name = "windows-targets"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
+dependencies = [
+ "windows_aarch64_gnullvm 0.52.5",
+ "windows_aarch64_msvc 0.52.5",
+ "windows_i686_gnu 0.52.5",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc 0.52.5",
+ "windows_x86_64_gnu 0.52.5",
+ "windows_x86_64_gnullvm 0.52.5",
+ "windows_x86_64_msvc 0.52.5",
+]
+
+[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1183,6 +1232,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
+
+[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1195,6 +1250,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
+
+[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1207,6 +1268,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
+name = "windows_i686_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
+
+[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1219,6 +1292,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
+name = "windows_i686_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
+
+[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1231,6 +1310,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
+
+[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1243,6 +1328,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
+
+[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1255,6 +1346,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
+
+[[package]]
name = "winnow"
version = "0.5.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1265,18 +1362,18 @@ dependencies = [
[[package]]
name = "zerocopy"
-version = "0.7.25"
+version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557"
+checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
-version = "0.7.25"
+version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b"
+checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [
"proc-macro2",
"quote",
diff --git a/Cargo.toml b/Cargo.toml
index 78c9603..6e6ef1f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,25 +30,24 @@ wildcard_imports = "allow"
obfuscated_if_else = "allow"
[dependencies]
-ahash = "0.8.6"
+ahash = "0.8.11"
ansi_term = "0.12.1"
anyhow = "1.0.75"
chrono = { version = "0.4.24", default-features = false, features = ["clock", "std"] }
-clap = { version = "4.4.10", features = ["derive"] }
+clap = { version = "4.5.4", features = ["derive"] }
clap_complete = "4.1.1"
config = { version = "0.14.0", default-features = false, features = ["toml"] }
-crossterm = "0.26.1"
-ctrlc = "3.4.0"
+crossterm = "0.27.0"
+ctrlc = "3.4.4"
dirs = "5.0"
errno = "0.3.1"
filesize = "0.2.0"
-ignore = "0.4.2"
+ignore = "0.4.22"
indextree = "4.6.0"
-log = { version = "0.4.20", features = ["std"] }
-lscolors = { version = "0.13.0", features = ["ansi_term"] }
-once_cell = "1.17.0"
-regex = "1.7.3"
-terminal_size = "0.2.6"
+lscolors = { version = "0.17.0", features = ["ansi_term"] }
+once_cell = "1.19.0"
+regex = "1.10.4"
+terminal_size = "0.3.0"
thiserror = "1.0.40"
toml = "0.8.8"
diff --git a/rustfmt.toml b/rustfmt.toml
deleted file mode 100644
index 8c795ae..0000000
--- a/rustfmt.toml
+++ /dev/null
@@ -1 +0,0 @@
-match_block_trailing_comma = true
diff --git a/src/disk/mod.rs b/src/disk/mod.rs
index 044407f..70bfecf 100644
--- a/src/disk/mod.rs
+++ b/src/disk/mod.rs
@@ -118,13 +118,8 @@ impl Usage {
let word_count =
std::fs::read_to_string(data.path()).map(|data| data.split_whitespace().count())?;
- let word_count = u64::try_from(word_count).map_or_else(
- |e| {
- log::warn!("Usage::init_word_count {e}");
- Self::WordCount(word_count as u64)
- },
- Self::WordCount,
- );
+ let word_count = u64::try_from(word_count)
+ .map_or_else(|_| Self::WordCount(word_count as u64), Self::WordCount);
Ok(word_count)
}
@@ -143,13 +138,8 @@ impl Usage {
let line_count = fs::read_to_string(data.path()).map(|data| data.lines().count())?;
- let line_count = u64::try_from(line_count).map_or_else(
- |e| {
- log::warn!("Usage::init_line_count {e}");
- Self::WordCount(line_count as u64)
- },
- Self::LineCount,
- );
+ let line_count = u64::try_from(line_count)
+ .map_or_else(|_| Self::WordCount(line_count as u64), Self::LineCount);
Ok(line_count)
}
@@ -192,7 +182,7 @@ impl Display for Usage {
let bytes = ($v as f64) / prefix.base_value();
write!(f, "{bytes:.FLOAT_PRECISION$} {prefix}B")
}
- },
+ }
BytePresentation::Si => {
let prefix = prefix::Si::from($v);
@@ -202,7 +192,7 @@ impl Display for Usage {
let bytes = ($v as f64) / prefix.base_value();
write!(f, "{bytes:.1} {prefix}B")
}
- },
+ }
}
};
}
diff --git a/src/file/mod.rs b/src/file/mod.rs
index 473bbfd..b3fae8d 100644
--- a/src/file/mod.rs
+++ b/src/file/mod.rs
@@ -46,6 +46,14 @@ pub struct File {
unix_attrs: unix::Attrs,
}
+// For keeping track of the count of file-types while loading from disk.
+#[derive(Default)]
+pub struct Accumulator {
+ num_file: usize,
+ num_dir: usize,
+ num_link: usize,
+}
+
/// [`Display`] implementation concerned with human-readable presentation of the file-name.
pub struct DisplayName<'a> {
file: &'a File,
@@ -246,6 +254,24 @@ impl Deref for File {
}
}
+impl Accumulator {
+ pub fn total(&self) -> usize {
+ self.num_dir + self.num_file + self.num_link
+ }
+
+ pub fn increment(&mut self, ft: Option<fs::FileType>) {
+ let Some(file_type) = ft else { return };
+
+ if file_type.is_file() {
+ self.num_file += 1;
+ } else if file_type.is_dir() {
+ self.num_dir += 1;
+ } else if file_type.is_symlink() {
+ self.num_link += 1;
+ }
+ }
+}
+
impl Display for DisplayName<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let file_name = self.file.file_name().to_string_lossy();
@@ -266,7 +292,7 @@ impl Display for DisplayPath<'_> {
let path = self.file.path();
path.strip_prefix(prefix)
.map_or_else(|_| path.display(), |p| p.display())
- },
+ }
None => self.file.path().display(),
};
@@ -279,3 +305,29 @@ impl Display for DisplayPath<'_> {
}
}
}
+
+impl Display for Accumulator {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let mut displayed_count = Vec::new();
+
+ match self.num_dir {
+ n if n > 1 => displayed_count.push(format!("{} directories", n)),
+ 1 => displayed_count.push("1 directory".to_string()),
+ _ => (),
+ }
+
+ match self.num_file {
+ n if n > 1 => displayed_count.push(format!("{} files", n)),
+ 1 => displayed_count.push("1 file".to_string()),
+ _ => (),
+ }
+
+ match self.num_link {
+ n if n > 1 => displayed_count.push(format!("{} links", n)),
+ 1 => displayed_count.push("1 link".to_string()),
+ _ => (),
+ }
+
+ writeln!(f, "{}", displayed_count.join(", "))
+ }
+}
diff --git a/src/file/tree/filter.rs b/src/file/tree/filter.rs
index 98e8ee1..09b0e2f 100644
--- a/src/file/tree/filter.rs
+++ b/src/file/tree/filter.rs
@@ -90,7 +90,7 @@ impl Tree {
match ft {
FileType::Dir if matches!(layout, Layout::Tree | Layout::InvertedTree) => {
filters.push(Box::new(|f| f.is_dir()))
- },
+ }
FileType::Dir => filters.push(Box::new(|f| f.is_dir())),
FileType::File => filters.push(Box::new(|f| f.is_file())),
FileType::Symlink => filters.push(Box::new(|f| f.is_symlink())),
@@ -152,7 +152,7 @@ impl Tree {
to_remove
.into_iter()
.for_each(|n| n.remove(&mut self.arena));
- },
+ }
_ => {
let to_remove = self
.root_id
@@ -167,7 +167,7 @@ impl Tree {
to_remove
.into_iter()
.for_each(|n| n.remove_subtree(&mut self.arena));
- },
+ }
};
Ok(())
@@ -230,7 +230,7 @@ impl Tree {
to_remove
.into_iter()
.for_each(|n| n.remove(&mut self.arena));
- },
+ }
_ => {
let to_remove = self
.root_id
@@ -251,7 +251,7 @@ impl Tree {
to_remove
.into_iter()
.for_each(|n| n.remove_subtree(&mut self.arena));
- },
+ }
}
Ok(())
diff --git a/src/file/tree/mod.rs b/src/file/tree/mod.rs
index afaa8c2..650fba2 100644
--- a/src/file/tree/mod.rs
+++ b/src/file/tree/mod.rs
@@ -2,6 +2,7 @@ use super::order;
use crate::{
error::prelude::*,
file::File,
+ progress,
user::{
args::{Layout, Sort, SortType},
column, Context,
@@ -41,13 +42,16 @@ pub enum TreeError {
impl Tree {
/// Like [`Tree::init`] but leverages parallelism for disk-reads and [`File`] initialization.
- pub fn init(ctx: &Context) -> Result<(Self, column::Metadata)> {
- let TransitionState {
- mut arena,
- mut branches,
- mut column_metadata,
- root_id,
- } = Self::load(ctx)?;
+ pub fn init(ctx: &Context) -> Result<(Self, super::Accumulator, column::Metadata)> {
+ let (
+ TransitionState {
+ mut arena,
+ mut branches,
+ mut column_metadata,
+ root_id,
+ },
+ accumulator,
+ ) = Self::load(ctx)?;
let mut dir_stack = vec![root_id];
let mut inode_set = HashSet::default();
@@ -83,23 +87,15 @@ impl Tree {
continue 'outer;
}
- match dirent_node.inode() {
- Ok(inode) => {