mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1644e67b11 | |||
| a06a001886 | |||
| fd9e97bcfa | |||
| 3ed95ee399 | |||
| 58c9f6d509 | |||
| 3f2f7a8bb2 | |||
| b7176cf887 | |||
| d65f41097e | |||
| 08e4240b41 | |||
| 028ca1fdc7 | |||
| 4f6255971b | |||
| cab250aa0e | |||
| 5f76db27c9 | |||
| a34e78f912 | |||
| 1ffda38264 | |||
| e78690e4f5 | |||
| 5b87260467 | |||
| 2c34c38b29 | |||
| a1574d6a06 | |||
| 184ea1f956 | |||
| a3dcab9454 | |||
| 658b11d0f8 | |||
| e2fe656296 | |||
| 87581f328e | |||
| ecd6b85c17 | |||
| b86e5c8c88 | |||
| 25c016f98a | |||
| 69c4c63357 | |||
| fbd34ec4c2 | |||
| 7c75c1b0a9 | |||
| b54a215805 | |||
| 0364cf781e | |||
| a8bf76cb22 | |||
| 4df4eeaa38 | |||
| ebb3b8cceb | |||
| e9bacdf875 |
Generated
+277
-66
@@ -4,13 +4,28 @@ version = 3
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "1.1.2"
|
version = "1.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
|
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android-tzdata"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android_system_properties"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ansi_term"
|
name = "ansi_term"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@@ -22,9 +37,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "0.6.12"
|
version = "0.6.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540"
|
checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"anstyle-parse",
|
"anstyle-parse",
|
||||||
@@ -83,6 +98,12 @@ dependencies = [
|
|||||||
"wait-timeout",
|
"wait-timeout",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.3.2"
|
version = "1.3.2"
|
||||||
@@ -91,21 +112,33 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.4.2"
|
version = "2.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
|
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bstr"
|
name = "bstr"
|
||||||
version = "1.9.0"
|
version = "1.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc"
|
checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
"regex-automata",
|
"regex-automata",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bumpalo"
|
||||||
|
version = "3.16.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.0.97"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@@ -113,19 +146,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "cfg_aliases"
|
||||||
version = "4.5.1"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da"
|
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono"
|
||||||
|
version = "0.4.38"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
||||||
|
dependencies = [
|
||||||
|
"android-tzdata",
|
||||||
|
"iana-time-zone",
|
||||||
|
"js-sys",
|
||||||
|
"num-traits",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-targets 0.52.4",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "4.5.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.1"
|
version = "4.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb"
|
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
@@ -206,6 +259,16 @@ version = "0.8.19"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
|
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ctrlc"
|
||||||
|
version = "3.4.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345"
|
||||||
|
dependencies = [
|
||||||
|
"nix",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "difflib"
|
name = "difflib"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@@ -240,20 +303,23 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "du-dust"
|
name = "du-dust"
|
||||||
version = "0.9.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
"assert_cmd",
|
"assert_cmd",
|
||||||
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete",
|
"clap_complete",
|
||||||
"clap_mangen",
|
"clap_mangen",
|
||||||
"config-file",
|
"config-file",
|
||||||
|
"ctrlc",
|
||||||
"directories",
|
"directories",
|
||||||
"filesize",
|
"filesize",
|
||||||
"lscolors",
|
"lscolors",
|
||||||
"rayon",
|
"rayon",
|
||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"stfu8",
|
"stfu8",
|
||||||
"sysinfo",
|
"sysinfo",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
@@ -281,9 +347,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "2.0.1"
|
version = "2.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
|
checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filesize"
|
name = "filesize"
|
||||||
@@ -307,9 +373,32 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.3.6"
|
version = "0.3.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd"
|
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone"
|
||||||
|
version = "0.1.60"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
|
||||||
|
dependencies = [
|
||||||
|
"android_system_properties",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"iana-time-zone-haiku",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone-haiku"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "io-lifetimes"
|
name = "io-lifetimes"
|
||||||
@@ -323,10 +412,25 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "itoa"
|
||||||
version = "0.2.153"
|
version = "1.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "js-sys"
|
||||||
|
version = "0.3.69"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
|
||||||
|
dependencies = [
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.155"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libredox"
|
name = "libredox"
|
||||||
@@ -334,7 +438,7 @@ version = "0.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
|
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.2",
|
"bitflags 2.5.0",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
]
|
]
|
||||||
@@ -351,6 +455,12 @@ version = "0.4.13"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
|
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lscolors"
|
name = "lscolors"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
@@ -367,6 +477,18 @@ version = "2.7.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.28.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.5.0",
|
||||||
|
"cfg-if",
|
||||||
|
"cfg_aliases",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ntapi"
|
name = "ntapi"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
@@ -386,6 +508,15 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.19.0"
|
version = "1.19.0"
|
||||||
@@ -427,9 +558,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.78"
|
version = "1.0.79"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
|
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
@@ -445,9 +576,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon"
|
name = "rayon"
|
||||||
version = "1.8.1"
|
version = "1.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051"
|
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either",
|
"either",
|
||||||
"rayon-core",
|
"rayon-core",
|
||||||
@@ -485,9 +616,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.10.3"
|
version = "1.10.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
|
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -497,9 +628,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-automata"
|
name = "regex-automata"
|
||||||
version = "0.4.5"
|
version = "0.4.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
|
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -534,17 +665,23 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "0.38.31"
|
version = "0.38.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
|
checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.2",
|
"bitflags 2.5.0",
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys 0.4.13",
|
"linux-raw-sys 0.4.13",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ryu"
|
||||||
|
version = "1.0.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.197"
|
version = "1.0.197"
|
||||||
@@ -565,6 +702,17 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.116"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stfu8"
|
name = "stfu8"
|
||||||
version = "0.2.7"
|
version = "0.2.7"
|
||||||
@@ -579,9 +727,9 @@ checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.50"
|
version = "2.0.55"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb"
|
checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -605,13 +753,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
version = "3.10.0"
|
version = "3.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
|
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"fastrand",
|
"fastrand",
|
||||||
"rustix 0.38.31",
|
"rustix 0.38.32",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -633,18 +781,18 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.57"
|
version = "1.0.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
|
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.57"
|
version = "1.0.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
|
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -699,6 +847,60 @@ version = "0.11.0+wasi-snapshot-preview1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen"
|
||||||
|
version = "0.2.92"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-backend"
|
||||||
|
version = "0.2.92"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"log",
|
||||||
|
"once_cell",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro"
|
||||||
|
version = "0.2.92"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro-support"
|
||||||
|
version = "0.2.92"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-backend",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-shared"
|
||||||
|
version = "0.2.92"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
@@ -730,6 +932,15 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-core"
|
||||||
|
version = "0.52.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.52.4",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.48.0"
|
version = "0.48.0"
|
||||||
@@ -745,7 +956,7 @@ version = "0.52.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets 0.52.0",
|
"windows-targets 0.52.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -765,17 +976,17 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-targets"
|
||||||
version = "0.52.0"
|
version = "0.52.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows_aarch64_gnullvm 0.52.0",
|
"windows_aarch64_gnullvm 0.52.4",
|
||||||
"windows_aarch64_msvc 0.52.0",
|
"windows_aarch64_msvc 0.52.4",
|
||||||
"windows_i686_gnu 0.52.0",
|
"windows_i686_gnu 0.52.4",
|
||||||
"windows_i686_msvc 0.52.0",
|
"windows_i686_msvc 0.52.4",
|
||||||
"windows_x86_64_gnu 0.52.0",
|
"windows_x86_64_gnu 0.52.4",
|
||||||
"windows_x86_64_gnullvm 0.52.0",
|
"windows_x86_64_gnullvm 0.52.4",
|
||||||
"windows_x86_64_msvc 0.52.0",
|
"windows_x86_64_msvc 0.52.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -786,9 +997,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_gnullvm"
|
name = "windows_aarch64_gnullvm"
|
||||||
version = "0.52.0"
|
version = "0.52.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
@@ -798,9 +1009,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
version = "0.52.0"
|
version = "0.52.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
@@ -810,9 +1021,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
version = "0.52.0"
|
version = "0.52.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
@@ -822,9 +1033,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
version = "0.52.0"
|
version = "0.52.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
@@ -834,9 +1045,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
version = "0.52.0"
|
version = "0.52.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
@@ -846,9 +1057,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
version = "0.52.0"
|
version = "0.52.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
@@ -858,6 +1069,6 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
version = "0.52.0"
|
version = "0.52.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
|
||||||
|
|||||||
+4
-1
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "du-dust"
|
name = "du-dust"
|
||||||
description = "A more intuitive version of du"
|
description = "A more intuitive version of du"
|
||||||
version = "0.9.0"
|
version = "1.0.0"
|
||||||
authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"]
|
authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@@ -38,8 +38,11 @@ stfu8 = "0.2"
|
|||||||
regex = "1"
|
regex = "1"
|
||||||
config-file = "0.2"
|
config-file = "0.2"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1.0"
|
||||||
directories = "4"
|
directories = "4"
|
||||||
sysinfo = "0.27"
|
sysinfo = "0.27"
|
||||||
|
ctrlc = "3.4"
|
||||||
|
chrono = "0.4"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winapi-util = "0.1"
|
winapi-util = "0.1"
|
||||||
|
|||||||
@@ -25,12 +25,16 @@ Because I want an easy way to see where my disk is being used.
|
|||||||
|
|
||||||
#### 🍺 Homebrew (Linux)
|
#### 🍺 Homebrew (Linux)
|
||||||
|
|
||||||
- `brew tap tgotwig/linux-dust && brew install dust`
|
- `brew install dust`
|
||||||
|
|
||||||
#### [Pacstall](https://github.com/pacstall/pacstall) (Debian/Ubuntu)
|
#### [Pacstall](https://github.com/pacstall/pacstall) (Debian/Ubuntu)
|
||||||
|
|
||||||
- `pacstall -I dust-bin`
|
- `pacstall -I dust-bin`
|
||||||
|
|
||||||
|
### Anaconda (conda-forge)
|
||||||
|
|
||||||
|
- `conda install -c conda-forge dust`
|
||||||
|
|
||||||
#### [deb-get](https://github.com/wimpysworld/deb-get) (Debian/Ubuntu)
|
#### [deb-get](https://github.com/wimpysworld/deb-get) (Debian/Ubuntu)
|
||||||
|
|
||||||
- `deb-get install du-dust`
|
- `deb-get install du-dust`
|
||||||
@@ -68,13 +72,14 @@ Usage: dust -d 3 (Shows 3 levels of subdirectories)
|
|||||||
Usage: dust -D (Show only directories (eg dust -D))
|
Usage: dust -D (Show only directories (eg dust -D))
|
||||||
Usage: dust -F (Show only files - finds your largest files)
|
Usage: dust -F (Show only files - finds your largest files)
|
||||||
Usage: dust -r (reverse order of output)
|
Usage: dust -r (reverse order of output)
|
||||||
Usage: dust -H (si print sizes in powers of 1000 instead of 1024)
|
Usage: dust -o si/b/kb/kib/mb/mib/gb/gib (si - prints sizes in powers of 1000. Others print size in that format).
|
||||||
Usage: dust -X ignore (ignore all files and directories with the name 'ignore')
|
Usage: dust -X ignore (ignore all files and directories with the name 'ignore')
|
||||||
Usage: dust -x (Only show directories on the same filesystem)
|
Usage: dust -x (Only show directories on the same filesystem)
|
||||||
Usage: dust -b (Do not show percentages or draw ASCII bars)
|
Usage: dust -b (Do not show percentages or draw ASCII bars)
|
||||||
Usage: dust -B (--bars-on-right - Percent bars moved to right side of screen])
|
Usage: dust -B (--bars-on-right - Percent bars moved to right side of screen)
|
||||||
Usage: dust -i (Do not show hidden files)
|
Usage: dust -i (Do not show hidden files)
|
||||||
Usage: dust -c (No colors [monochrome])
|
Usage: dust -c (No colors [monochrome])
|
||||||
|
Usage: dust -C (Force colors)
|
||||||
Usage: dust -f (Count files instead of diskspace)
|
Usage: dust -f (Count files instead of diskspace)
|
||||||
Usage: dust -t (Group by filetype)
|
Usage: dust -t (Group by filetype)
|
||||||
Usage: dust -z 10M (min-size, Only include files larger than 10M)
|
Usage: dust -z 10M (min-size, Only include files larger than 10M)
|
||||||
@@ -85,7 +90,8 @@ Usage: dust -P (Disable the progress indicator)
|
|||||||
Usage: dust -R (For screen readers. Removes bars/symbols. Adds new column: depth level. (May want to use -p for full path too))
|
Usage: dust -R (For screen readers. Removes bars/symbols. Adds new column: depth level. (May want to use -p for full path too))
|
||||||
Usage: dust -S (Custom Stack size - Use if you see: 'fatal runtime error: stack overflow' (default allocation: low memory=1048576, high memory=1073741824)"),
|
Usage: dust -S (Custom Stack size - Use if you see: 'fatal runtime error: stack overflow' (default allocation: low memory=1048576, high memory=1073741824)"),
|
||||||
Usage: dust --skip-total (No total row will be displayed)
|
Usage: dust --skip-total (No total row will be displayed)
|
||||||
Usage: dust -z 4000000 (Exclude output files/directories below size 4MB)
|
Usage: dust -z 40000/30MB/20kib (Exclude output files/directories below size 40000 bytes / 30MB / 20KiB)
|
||||||
|
Usage: dust -j (Prints JSON representation of directories, try: dust -j | jq)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Config file
|
## Config file
|
||||||
|
|||||||
+34
-21
@@ -15,24 +15,34 @@ _dust() {
|
|||||||
|
|
||||||
local context curcontext="$curcontext" state line
|
local context curcontext="$curcontext" state line
|
||||||
_arguments "${_arguments_options[@]}" \
|
_arguments "${_arguments_options[@]}" \
|
||||||
'-d+[Depth to show]: : ' \
|
'-d+[Depth to show]:DEPTH: ' \
|
||||||
'--depth=[Depth to show]: : ' \
|
'--depth=[Depth to show]:DEPTH: ' \
|
||||||
'-n+[Number of lines of output to show. (Default is terminal_height - 10)]: : ' \
|
'-T+[Number of threads to use]: : ' \
|
||||||
'--number-of-lines=[Number of lines of output to show. (Default is terminal_height - 10)]: : ' \
|
'--threads=[Number of threads to use]: : ' \
|
||||||
'*-X+[Exclude any file or directory with this name]: : ' \
|
'-n+[Number of lines of output to show. (Default is terminal_height - 10)]:NUMBER: ' \
|
||||||
'*--ignore-directory=[Exclude any file or directory with this name]: : ' \
|
'--number-of-lines=[Number of lines of output to show. (Default is terminal_height - 10)]:NUMBER: ' \
|
||||||
'-I+[Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter]: : ' \
|
'*-X+[Exclude any file or directory with this name]:PATH:_files' \
|
||||||
'--ignore-all-in-file=[Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter]: : ' \
|
'*--ignore-directory=[Exclude any file or directory with this name]:PATH:_files' \
|
||||||
'-z+[Minimum size file to include in output]: : ' \
|
'-I+[Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter]:FILE:_files' \
|
||||||
'--min-size=[Minimum size file to include in output]: : ' \
|
'--ignore-all-in-file=[Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter]:FILE:_files' \
|
||||||
'(-e --filter -t --file_types)*-v+[Exclude filepaths matching this regex. To ignore png files type\: -v "\\.png\$" ]: : ' \
|
'-z+[Minimum size file to include in output]:MIN_SIZE: ' \
|
||||||
'(-e --filter -t --file_types)*--invert-filter=[Exclude filepaths matching this regex. To ignore png files type\: -v "\\.png\$" ]: : ' \
|
'--min-size=[Minimum size file to include in output]:MIN_SIZE: ' \
|
||||||
'(-t --file_types)*-e+[Only include filepaths matching this regex. For png files type\: -e "\\.png\$" ]: : ' \
|
'(-e --filter -t --file_types)*-v+[Exclude filepaths matching this regex. To ignore png files type\: -v "\\.png\$" ]:REGEX: ' \
|
||||||
'(-t --file_types)*--filter=[Only include filepaths matching this regex. For png files type\: -e "\\.png\$" ]: : ' \
|
'(-e --filter -t --file_types)*--invert-filter=[Exclude filepaths matching this regex. To ignore png files type\: -v "\\.png\$" ]:REGEX: ' \
|
||||||
'-w+[Specify width of output overriding the auto detection of terminal width]: : ' \
|
'(-t --file_types)*-e+[Only include filepaths matching this regex. For png files type\: -e "\\.png\$" ]:REGEX: ' \
|
||||||
'--terminal_width=[Specify width of output overriding the auto detection of terminal width]: : ' \
|
'(-t --file_types)*--filter=[Only include filepaths matching this regex. For png files type\: -e "\\.png\$" ]:REGEX: ' \
|
||||||
'-S+[Specify memory to use as stack size - use if you see\: '\''fatal runtime error\: stack overflow'\'' (default low memory=1048576, high memory=1073741824)]: : ' \
|
'-w+[Specify width of output overriding the auto detection of terminal width]:WIDTH: ' \
|
||||||
'--stack-size=[Specify memory to use as stack size - use if you see\: '\''fatal runtime error\: stack overflow'\'' (default low memory=1048576, high memory=1073741824)]: : ' \
|
'--terminal_width=[Specify width of output overriding the auto detection of terminal width]:WIDTH: ' \
|
||||||
|
'-o+[Changes output display size. si will print sizes in powers of 1000. b k m g t kb mb gb tb will print the whole tree in that size.]:FORMAT:(si b k m g t kb mb gb tb)' \
|
||||||
|
'--output-format=[Changes output display size. si will print sizes in powers of 1000. b k m g t kb mb gb tb will print the whole tree in that size.]:FORMAT:(si b k m g t kb mb gb tb)' \
|
||||||
|
'-S+[Specify memory to use as stack size - use if you see\: '\''fatal runtime error\: stack overflow'\'' (default low memory=1048576, high memory=1073741824)]:STACK_SIZE: ' \
|
||||||
|
'--stack-size=[Specify memory to use as stack size - use if you see\: '\''fatal runtime error\: stack overflow'\'' (default low memory=1048576, high memory=1073741824)]:STACK_SIZE: ' \
|
||||||
|
'-M+[+/-n matches files modified more/less than n days ago , and n matches files modified exactly n days ago, days are rounded down.That is +n => (−∞, curr−(n+1)), n => \[curr−(n+1), curr−n), and -n => (𝑐𝑢𝑟𝑟−𝑛, +∞)]: : ' \
|
||||||
|
'--mtime=[+/-n matches files modified more/less than n days ago , and n matches files modified exactly n days ago, days are rounded down.That is +n => (−∞, curr−(n+1)), n => \[curr−(n+1), curr−n), and -n => (𝑐𝑢𝑟𝑟−𝑛, +∞)]: : ' \
|
||||||
|
'-A+[just like -mtime, but based on file access time]: : ' \
|
||||||
|
'--atime=[just like -mtime, but based on file access time]: : ' \
|
||||||
|
'-y+[just like -mtime, but based on file change time]: : ' \
|
||||||
|
'--ctime=[just like -mtime, but based on file change time]: : ' \
|
||||||
'-p[Subdirectories will not have their path shortened]' \
|
'-p[Subdirectories will not have their path shortened]' \
|
||||||
'--full-paths[Subdirectories will not have their path shortened]' \
|
'--full-paths[Subdirectories will not have their path shortened]' \
|
||||||
'-L[dereference sym links - Treat sym links as directories and go into them]' \
|
'-L[dereference sym links - Treat sym links as directories and go into them]' \
|
||||||
@@ -45,6 +55,8 @@ _dust() {
|
|||||||
'--reverse[Print tree upside down (biggest highest)]' \
|
'--reverse[Print tree upside down (biggest highest)]' \
|
||||||
'-c[No colors will be printed (Useful for commands like\: watch)]' \
|
'-c[No colors will be printed (Useful for commands like\: watch)]' \
|
||||||
'--no-colors[No colors will be printed (Useful for commands like\: watch)]' \
|
'--no-colors[No colors will be printed (Useful for commands like\: watch)]' \
|
||||||
|
'-C[Force colors print]' \
|
||||||
|
'--force-colors[Force colors print]' \
|
||||||
'-b[No percent bars or percentages will be displayed]' \
|
'-b[No percent bars or percentages will be displayed]' \
|
||||||
'--no-percent-bars[No percent bars or percentages will be displayed]' \
|
'--no-percent-bars[No percent bars or percentages will be displayed]' \
|
||||||
'-B[percent bars moved to right side of screen]' \
|
'-B[percent bars moved to right side of screen]' \
|
||||||
@@ -58,19 +70,20 @@ _dust() {
|
|||||||
'--ignore_hidden[Do not display hidden files]' \
|
'--ignore_hidden[Do not display hidden files]' \
|
||||||
'(-d --depth -D --only-dir)-t[show only these file types]' \
|
'(-d --depth -D --only-dir)-t[show only these file types]' \
|
||||||
'(-d --depth -D --only-dir)--file_types[show only these file types]' \
|
'(-d --depth -D --only-dir)--file_types[show only these file types]' \
|
||||||
'-H[print sizes in powers of 1000 (e.g., 1.1G)]' \
|
|
||||||
'--si[print sizes in powers of 1000 (e.g., 1.1G)]' \
|
|
||||||
'-P[Disable the progress indication.]' \
|
'-P[Disable the progress indication.]' \
|
||||||
'--no-progress[Disable the progress indication.]' \
|
'--no-progress[Disable the progress indication.]' \
|
||||||
|
'--print-errors[Print path with errors.]' \
|
||||||
'(-F --only-file -t --file_types)-D[Only directories will be displayed.]' \
|
'(-F --only-file -t --file_types)-D[Only directories will be displayed.]' \
|
||||||
'(-F --only-file -t --file_types)--only-dir[Only directories will be displayed.]' \
|
'(-F --only-file -t --file_types)--only-dir[Only directories will be displayed.]' \
|
||||||
'(-D --only-dir)-F[Only files will be displayed. (Finds your largest files)]' \
|
'(-D --only-dir)-F[Only files will be displayed. (Finds your largest files)]' \
|
||||||
'(-D --only-dir)--only-file[Only files will be displayed. (Finds your largest files)]' \
|
'(-D --only-dir)--only-file[Only files will be displayed. (Finds your largest files)]' \
|
||||||
|
'-j[Output the directory tree as json to the current directory]' \
|
||||||
|
'--output-json[Output the directory tree as json to the current directory]' \
|
||||||
'-h[Print help]' \
|
'-h[Print help]' \
|
||||||
'--help[Print help]' \
|
'--help[Print help]' \
|
||||||
'-V[Print version]' \
|
'-V[Print version]' \
|
||||||
'--version[Print version]' \
|
'--version[Print version]' \
|
||||||
'*::params:' \
|
'*::params:_files' \
|
||||||
&& ret=0
|
&& ret=0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-2
@@ -23,6 +23,8 @@ Register-ArgumentCompleter -Native -CommandName 'dust' -ScriptBlock {
|
|||||||
'dust' {
|
'dust' {
|
||||||
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'Depth to show')
|
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'Depth to show')
|
||||||
[CompletionResult]::new('--depth', 'depth', [CompletionResultType]::ParameterName, 'Depth to show')
|
[CompletionResult]::new('--depth', 'depth', [CompletionResultType]::ParameterName, 'Depth to show')
|
||||||
|
[CompletionResult]::new('-T', 'T ', [CompletionResultType]::ParameterName, 'Number of threads to use')
|
||||||
|
[CompletionResult]::new('--threads', 'threads', [CompletionResultType]::ParameterName, 'Number of threads to use')
|
||||||
[CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'Number of lines of output to show. (Default is terminal_height - 10)')
|
[CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'Number of lines of output to show. (Default is terminal_height - 10)')
|
||||||
[CompletionResult]::new('--number-of-lines', 'number-of-lines', [CompletionResultType]::ParameterName, 'Number of lines of output to show. (Default is terminal_height - 10)')
|
[CompletionResult]::new('--number-of-lines', 'number-of-lines', [CompletionResultType]::ParameterName, 'Number of lines of output to show. (Default is terminal_height - 10)')
|
||||||
[CompletionResult]::new('-X', 'X ', [CompletionResultType]::ParameterName, 'Exclude any file or directory with this name')
|
[CompletionResult]::new('-X', 'X ', [CompletionResultType]::ParameterName, 'Exclude any file or directory with this name')
|
||||||
@@ -37,8 +39,16 @@ Register-ArgumentCompleter -Native -CommandName 'dust' -ScriptBlock {
|
|||||||
[CompletionResult]::new('--filter', 'filter', [CompletionResultType]::ParameterName, 'Only include filepaths matching this regex. For png files type: -e "\.png$" ')
|
[CompletionResult]::new('--filter', 'filter', [CompletionResultType]::ParameterName, 'Only include filepaths matching this regex. For png files type: -e "\.png$" ')
|
||||||
[CompletionResult]::new('-w', 'w', [CompletionResultType]::ParameterName, 'Specify width of output overriding the auto detection of terminal width')
|
[CompletionResult]::new('-w', 'w', [CompletionResultType]::ParameterName, 'Specify width of output overriding the auto detection of terminal width')
|
||||||
[CompletionResult]::new('--terminal_width', 'terminal_width', [CompletionResultType]::ParameterName, 'Specify width of output overriding the auto detection of terminal width')
|
[CompletionResult]::new('--terminal_width', 'terminal_width', [CompletionResultType]::ParameterName, 'Specify width of output overriding the auto detection of terminal width')
|
||||||
|
[CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'Changes output display size. si will print sizes in powers of 1000. b k m g t kb mb gb tb will print the whole tree in that size.')
|
||||||
|
[CompletionResult]::new('--output-format', 'output-format', [CompletionResultType]::ParameterName, 'Changes output display size. si will print sizes in powers of 1000. b k m g t kb mb gb tb will print the whole tree in that size.')
|
||||||
[CompletionResult]::new('-S', 'S ', [CompletionResultType]::ParameterName, 'Specify memory to use as stack size - use if you see: ''fatal runtime error: stack overflow'' (default low memory=1048576, high memory=1073741824)')
|
[CompletionResult]::new('-S', 'S ', [CompletionResultType]::ParameterName, 'Specify memory to use as stack size - use if you see: ''fatal runtime error: stack overflow'' (default low memory=1048576, high memory=1073741824)')
|
||||||
[CompletionResult]::new('--stack-size', 'stack-size', [CompletionResultType]::ParameterName, 'Specify memory to use as stack size - use if you see: ''fatal runtime error: stack overflow'' (default low memory=1048576, high memory=1073741824)')
|
[CompletionResult]::new('--stack-size', 'stack-size', [CompletionResultType]::ParameterName, 'Specify memory to use as stack size - use if you see: ''fatal runtime error: stack overflow'' (default low memory=1048576, high memory=1073741824)')
|
||||||
|
[CompletionResult]::new('-M', 'M ', [CompletionResultType]::ParameterName, '+/-n matches files modified more/less than n days ago , and n matches files modified exactly n days ago, days are rounded down.That is +n => (−∞, curr−(n+1)), n => [curr−(n+1), curr−n), and -n => (𝑐𝑢𝑟𝑟−𝑛, +∞)')
|
||||||
|
[CompletionResult]::new('--mtime', 'mtime', [CompletionResultType]::ParameterName, '+/-n matches files modified more/less than n days ago , and n matches files modified exactly n days ago, days are rounded down.That is +n => (−∞, curr−(n+1)), n => [curr−(n+1), curr−n), and -n => (𝑐𝑢𝑟𝑟−𝑛, +∞)')
|
||||||
|
[CompletionResult]::new('-A', 'A ', [CompletionResultType]::ParameterName, 'just like -mtime, but based on file access time')
|
||||||
|
[CompletionResult]::new('--atime', 'atime', [CompletionResultType]::ParameterName, 'just like -mtime, but based on file access time')
|
||||||
|
[CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'just like -mtime, but based on file change time')
|
||||||
|
[CompletionResult]::new('--ctime', 'ctime', [CompletionResultType]::ParameterName, 'just like -mtime, but based on file change time')
|
||||||
[CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Subdirectories will not have their path shortened')
|
[CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Subdirectories will not have their path shortened')
|
||||||
[CompletionResult]::new('--full-paths', 'full-paths', [CompletionResultType]::ParameterName, 'Subdirectories will not have their path shortened')
|
[CompletionResult]::new('--full-paths', 'full-paths', [CompletionResultType]::ParameterName, 'Subdirectories will not have their path shortened')
|
||||||
[CompletionResult]::new('-L', 'L ', [CompletionResultType]::ParameterName, 'dereference sym links - Treat sym links as directories and go into them')
|
[CompletionResult]::new('-L', 'L ', [CompletionResultType]::ParameterName, 'dereference sym links - Treat sym links as directories and go into them')
|
||||||
@@ -51,6 +61,8 @@ Register-ArgumentCompleter -Native -CommandName 'dust' -ScriptBlock {
|
|||||||
[CompletionResult]::new('--reverse', 'reverse', [CompletionResultType]::ParameterName, 'Print tree upside down (biggest highest)')
|
[CompletionResult]::new('--reverse', 'reverse', [CompletionResultType]::ParameterName, 'Print tree upside down (biggest highest)')
|
||||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'No colors will be printed (Useful for commands like: watch)')
|
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'No colors will be printed (Useful for commands like: watch)')
|
||||||
[CompletionResult]::new('--no-colors', 'no-colors', [CompletionResultType]::ParameterName, 'No colors will be printed (Useful for commands like: watch)')
|
[CompletionResult]::new('--no-colors', 'no-colors', [CompletionResultType]::ParameterName, 'No colors will be printed (Useful for commands like: watch)')
|
||||||
|
[CompletionResult]::new('-C', 'C ', [CompletionResultType]::ParameterName, 'Force colors print')
|
||||||
|
[CompletionResult]::new('--force-colors', 'force-colors', [CompletionResultType]::ParameterName, 'Force colors print')
|
||||||
[CompletionResult]::new('-b', 'b', [CompletionResultType]::ParameterName, 'No percent bars or percentages will be displayed')
|
[CompletionResult]::new('-b', 'b', [CompletionResultType]::ParameterName, 'No percent bars or percentages will be displayed')
|
||||||
[CompletionResult]::new('--no-percent-bars', 'no-percent-bars', [CompletionResultType]::ParameterName, 'No percent bars or percentages will be displayed')
|
[CompletionResult]::new('--no-percent-bars', 'no-percent-bars', [CompletionResultType]::ParameterName, 'No percent bars or percentages will be displayed')
|
||||||
[CompletionResult]::new('-B', 'B ', [CompletionResultType]::ParameterName, 'percent bars moved to right side of screen')
|
[CompletionResult]::new('-B', 'B ', [CompletionResultType]::ParameterName, 'percent bars moved to right side of screen')
|
||||||
@@ -64,14 +76,15 @@ Register-ArgumentCompleter -Native -CommandName 'dust' -ScriptBlock {
|
|||||||
[CompletionResult]::new('--ignore_hidden', 'ignore_hidden', [CompletionResultType]::ParameterName, 'Do not display hidden files')
|
[CompletionResult]::new('--ignore_hidden', 'ignore_hidden', [CompletionResultType]::ParameterName, 'Do not display hidden files')
|
||||||
[CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'show only these file types')
|
[CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'show only these file types')
|
||||||
[CompletionResult]::new('--file_types', 'file_types', [CompletionResultType]::ParameterName, 'show only these file types')
|
[CompletionResult]::new('--file_types', 'file_types', [CompletionResultType]::ParameterName, 'show only these file types')
|
||||||
[CompletionResult]::new('-H', 'H ', [CompletionResultType]::ParameterName, 'print sizes in powers of 1000 (e.g., 1.1G)')
|
|
||||||
[CompletionResult]::new('--si', 'si', [CompletionResultType]::ParameterName, 'print sizes in powers of 1000 (e.g., 1.1G)')
|
|
||||||
[CompletionResult]::new('-P', 'P ', [CompletionResultType]::ParameterName, 'Disable the progress indication.')
|
[CompletionResult]::new('-P', 'P ', [CompletionResultType]::ParameterName, 'Disable the progress indication.')
|
||||||
[CompletionResult]::new('--no-progress', 'no-progress', [CompletionResultType]::ParameterName, 'Disable the progress indication.')
|
[CompletionResult]::new('--no-progress', 'no-progress', [CompletionResultType]::ParameterName, 'Disable the progress indication.')
|
||||||
|
[CompletionResult]::new('--print-errors', 'print-errors', [CompletionResultType]::ParameterName, 'Print path with errors.')
|
||||||
[CompletionResult]::new('-D', 'D ', [CompletionResultType]::ParameterName, 'Only directories will be displayed.')
|
[CompletionResult]::new('-D', 'D ', [CompletionResultType]::ParameterName, 'Only directories will be displayed.')
|
||||||
[CompletionResult]::new('--only-dir', 'only-dir', [CompletionResultType]::ParameterName, 'Only directories will be displayed.')
|
[CompletionResult]::new('--only-dir', 'only-dir', [CompletionResultType]::ParameterName, 'Only directories will be displayed.')
|
||||||
[CompletionResult]::new('-F', 'F ', [CompletionResultType]::ParameterName, 'Only files will be displayed. (Finds your largest files)')
|
[CompletionResult]::new('-F', 'F ', [CompletionResultType]::ParameterName, 'Only files will be displayed. (Finds your largest files)')
|
||||||
[CompletionResult]::new('--only-file', 'only-file', [CompletionResultType]::ParameterName, 'Only files will be displayed. (Finds your largest files)')
|
[CompletionResult]::new('--only-file', 'only-file', [CompletionResultType]::ParameterName, 'Only files will be displayed. (Finds your largest files)')
|
||||||
|
[CompletionResult]::new('-j', 'j', [CompletionResultType]::ParameterName, 'Output the directory tree as json to the current directory')
|
||||||
|
[CompletionResult]::new('--output-json', 'output-json', [CompletionResultType]::ParameterName, 'Output the directory tree as json to the current directory')
|
||||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||||
|
|||||||
+63
-1
@@ -19,7 +19,7 @@ _dust() {
|
|||||||
|
|
||||||
case "${cmd}" in
|
case "${cmd}" in
|
||||||
dust)
|
dust)
|
||||||
opts="-d -n -p -X -I -L -x -s -r -c -b -B -z -R -f -i -v -e -t -w -H -P -D -F -S -h -V --depth --number-of-lines --full-paths --ignore-directory --ignore-all-in-file --dereference-links --limit-filesystem --apparent-size --reverse --no-colors --no-percent-bars --bars-on-right --min-size --screen-reader --skip-total --filecount --ignore_hidden --invert-filter --filter --file_types --terminal_width --si --no-progress --only-dir --only-file --stack-size --help --version [params]..."
|
opts="-d -T -n -p -X -I -L -x -s -r -c -C -b -B -z -R -f -i -v -e -t -w -P -D -F -o -S -j -M -A -y -h -V --depth --threads --number-of-lines --full-paths --ignore-directory --ignore-all-in-file --dereference-links --limit-filesystem --apparent-size --reverse --no-colors --force-colors --no-percent-bars --bars-on-right --min-size --screen-reader --skip-total --filecount --ignore_hidden --invert-filter --filter --file_types --terminal_width --no-progress --print-errors --only-dir --only-file --output-format --stack-size --output-json --mtime --atime --ctime --help --version [PATH]..."
|
||||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||||
return 0
|
return 0
|
||||||
@@ -33,6 +33,14 @@ _dust() {
|
|||||||
COMPREPLY=($(compgen -f "${cur}"))
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
--threads)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-T)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
--number-of-lines)
|
--number-of-lines)
|
||||||
COMPREPLY=($(compgen -f "${cur}"))
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
return 0
|
return 0
|
||||||
@@ -50,11 +58,33 @@ _dust() {
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--ignore-all-in-file)
|
--ignore-all-in-file)
|
||||||
|
local oldifs
|
||||||
|
if [[ -v IFS ]]; then
|
||||||
|
oldifs="$IFS"
|
||||||
|
fi
|
||||||
|
IFS=$'\n'
|
||||||
COMPREPLY=($(compgen -f "${cur}"))
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
if [[ -v oldifs ]]; then
|
||||||
|
IFS="$oldifs"
|
||||||
|
fi
|
||||||
|
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
||||||
|
compopt -o filenames
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-I)
|
-I)
|
||||||
|
local oldifs
|
||||||
|
if [[ -v IFS ]]; then
|
||||||
|
oldifs="$IFS"
|
||||||
|
fi
|
||||||
|
IFS=$'\n'
|
||||||
COMPREPLY=($(compgen -f "${cur}"))
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
if [[ -v oldifs ]]; then
|
||||||
|
IFS="$oldifs"
|
||||||
|
fi
|
||||||
|
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
||||||
|
compopt -o filenames
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--min-size)
|
--min-size)
|
||||||
@@ -89,6 +119,14 @@ _dust() {
|
|||||||
COMPREPLY=($(compgen -f "${cur}"))
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
--output-format)
|
||||||
|
COMPREPLY=($(compgen -W "si b k m g t kb mb gb tb" -- "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-o)
|
||||||
|
COMPREPLY=($(compgen -W "si b k m g t kb mb gb tb" -- "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
--stack-size)
|
--stack-size)
|
||||||
COMPREPLY=($(compgen -f "${cur}"))
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
return 0
|
return 0
|
||||||
@@ -97,6 +135,30 @@ _dust() {
|
|||||||
COMPREPLY=($(compgen -f "${cur}"))
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
--mtime)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-M)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--atime)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-A)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--ctime)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-y)
|
||||||
|
COMPREPLY=($(compgen -f "${cur}"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
;;
|
;;
|
||||||
|
|||||||
+15
-2
@@ -20,6 +20,8 @@ set edit:completion:arg-completer[dust] = {|@words|
|
|||||||
&'dust'= {
|
&'dust'= {
|
||||||
cand -d 'Depth to show'
|
cand -d 'Depth to show'
|
||||||
cand --depth 'Depth to show'
|
cand --depth 'Depth to show'
|
||||||
|
cand -T 'Number of threads to use'
|
||||||
|
cand --threads 'Number of threads to use'
|
||||||
cand -n 'Number of lines of output to show. (Default is terminal_height - 10)'
|
cand -n 'Number of lines of output to show. (Default is terminal_height - 10)'
|
||||||
cand --number-of-lines 'Number of lines of output to show. (Default is terminal_height - 10)'
|
cand --number-of-lines 'Number of lines of output to show. (Default is terminal_height - 10)'
|
||||||
cand -X 'Exclude any file or directory with this name'
|
cand -X 'Exclude any file or directory with this name'
|
||||||
@@ -34,8 +36,16 @@ set edit:completion:arg-completer[dust] = {|@words|
|
|||||||
cand --filter 'Only include filepaths matching this regex. For png files type: -e "\.png$" '
|
cand --filter 'Only include filepaths matching this regex. For png files type: -e "\.png$" '
|
||||||
cand -w 'Specify width of output overriding the auto detection of terminal width'
|
cand -w 'Specify width of output overriding the auto detection of terminal width'
|
||||||
cand --terminal_width 'Specify width of output overriding the auto detection of terminal width'
|
cand --terminal_width 'Specify width of output overriding the auto detection of terminal width'
|
||||||
|
cand -o 'Changes output display size. si will print sizes in powers of 1000. b k m g t kb mb gb tb will print the whole tree in that size.'
|
||||||
|
cand --output-format 'Changes output display size. si will print sizes in powers of 1000. b k m g t kb mb gb tb will print the whole tree in that size.'
|
||||||
cand -S 'Specify memory to use as stack size - use if you see: ''fatal runtime error: stack overflow'' (default low memory=1048576, high memory=1073741824)'
|
cand -S 'Specify memory to use as stack size - use if you see: ''fatal runtime error: stack overflow'' (default low memory=1048576, high memory=1073741824)'
|
||||||
cand --stack-size 'Specify memory to use as stack size - use if you see: ''fatal runtime error: stack overflow'' (default low memory=1048576, high memory=1073741824)'
|
cand --stack-size 'Specify memory to use as stack size - use if you see: ''fatal runtime error: stack overflow'' (default low memory=1048576, high memory=1073741824)'
|
||||||
|
cand -M '+/-n matches files modified more/less than n days ago , and n matches files modified exactly n days ago, days are rounded down.That is +n => (−∞, curr−(n+1)), n => [curr−(n+1), curr−n), and -n => (𝑐𝑢𝑟𝑟−𝑛, +∞)'
|
||||||
|
cand --mtime '+/-n matches files modified more/less than n days ago , and n matches files modified exactly n days ago, days are rounded down.That is +n => (−∞, curr−(n+1)), n => [curr−(n+1), curr−n), and -n => (𝑐𝑢𝑟𝑟−𝑛, +∞)'
|
||||||
|
cand -A 'just like -mtime, but based on file access time'
|
||||||
|
cand --atime 'just like -mtime, but based on file access time'
|
||||||
|
cand -y 'just like -mtime, but based on file change time'
|
||||||
|
cand --ctime 'just like -mtime, but based on file change time'
|
||||||
cand -p 'Subdirectories will not have their path shortened'
|
cand -p 'Subdirectories will not have their path shortened'
|
||||||
cand --full-paths 'Subdirectories will not have their path shortened'
|
cand --full-paths 'Subdirectories will not have their path shortened'
|
||||||
cand -L 'dereference sym links - Treat sym links as directories and go into them'
|
cand -L 'dereference sym links - Treat sym links as directories and go into them'
|
||||||
@@ -48,6 +58,8 @@ set edit:completion:arg-completer[dust] = {|@words|
|
|||||||
cand --reverse 'Print tree upside down (biggest highest)'
|
cand --reverse 'Print tree upside down (biggest highest)'
|
||||||
cand -c 'No colors will be printed (Useful for commands like: watch)'
|
cand -c 'No colors will be printed (Useful for commands like: watch)'
|
||||||
cand --no-colors 'No colors will be printed (Useful for commands like: watch)'
|
cand --no-colors 'No colors will be printed (Useful for commands like: watch)'
|
||||||
|
cand -C 'Force colors print'
|
||||||
|
cand --force-colors 'Force colors print'
|
||||||
cand -b 'No percent bars or percentages will be displayed'
|
cand -b 'No percent bars or percentages will be displayed'
|
||||||
cand --no-percent-bars 'No percent bars or percentages will be displayed'
|
cand --no-percent-bars 'No percent bars or percentages will be displayed'
|
||||||
cand -B 'percent bars moved to right side of screen'
|
cand -B 'percent bars moved to right side of screen'
|
||||||
@@ -61,14 +73,15 @@ set edit:completion:arg-completer[dust] = {|@words|
|
|||||||
cand --ignore_hidden 'Do not display hidden files'
|
cand --ignore_hidden 'Do not display hidden files'
|
||||||
cand -t 'show only these file types'
|
cand -t 'show only these file types'
|
||||||
cand --file_types 'show only these file types'
|
cand --file_types 'show only these file types'
|
||||||
cand -H 'print sizes in powers of 1000 (e.g., 1.1G)'
|
|
||||||
cand --si 'print sizes in powers of 1000 (e.g., 1.1G)'
|
|
||||||
cand -P 'Disable the progress indication.'
|
cand -P 'Disable the progress indication.'
|
||||||
cand --no-progress 'Disable the progress indication.'
|
cand --no-progress 'Disable the progress indication.'
|
||||||
|
cand --print-errors 'Print path with errors.'
|
||||||
cand -D 'Only directories will be displayed.'
|
cand -D 'Only directories will be displayed.'
|
||||||
cand --only-dir 'Only directories will be displayed.'
|
cand --only-dir 'Only directories will be displayed.'
|
||||||
cand -F 'Only files will be displayed. (Finds your largest files)'
|
cand -F 'Only files will be displayed. (Finds your largest files)'
|
||||||
cand --only-file 'Only files will be displayed. (Finds your largest files)'
|
cand --only-file 'Only files will be displayed. (Finds your largest files)'
|
||||||
|
cand -j 'Output the directory tree as json to the current directory'
|
||||||
|
cand --output-json 'Output the directory tree as json to the current directory'
|
||||||
cand -h 'Print help'
|
cand -h 'Print help'
|
||||||
cand --help 'Print help'
|
cand --help 'Print help'
|
||||||
cand -V 'Print version'
|
cand -V 'Print version'
|
||||||
|
|||||||
+10
-3
@@ -1,18 +1,24 @@
|
|||||||
complete -c dust -s d -l depth -d 'Depth to show' -r
|
complete -c dust -s d -l depth -d 'Depth to show' -r
|
||||||
|
complete -c dust -s T -l threads -d 'Number of threads to use' -r
|
||||||
complete -c dust -s n -l number-of-lines -d 'Number of lines of output to show. (Default is terminal_height - 10)' -r
|
complete -c dust -s n -l number-of-lines -d 'Number of lines of output to show. (Default is terminal_height - 10)' -r
|
||||||
complete -c dust -s X -l ignore-directory -d 'Exclude any file or directory with this name' -r
|
complete -c dust -s X -l ignore-directory -d 'Exclude any file or directory with this name' -r -F
|
||||||
complete -c dust -s I -l ignore-all-in-file -d 'Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter' -r
|
complete -c dust -s I -l ignore-all-in-file -d 'Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter' -r -F
|
||||||
complete -c dust -s z -l min-size -d 'Minimum size file to include in output' -r
|
complete -c dust -s z -l min-size -d 'Minimum size file to include in output' -r
|
||||||
complete -c dust -s v -l invert-filter -d 'Exclude filepaths matching this regex. To ignore png files type: -v "\\.png$" ' -r
|
complete -c dust -s v -l invert-filter -d 'Exclude filepaths matching this regex. To ignore png files type: -v "\\.png$" ' -r
|
||||||
complete -c dust -s e -l filter -d 'Only include filepaths matching this regex. For png files type: -e "\\.png$" ' -r
|
complete -c dust -s e -l filter -d 'Only include filepaths matching this regex. For png files type: -e "\\.png$" ' -r
|
||||||
complete -c dust -s w -l terminal_width -d 'Specify width of output overriding the auto detection of terminal width' -r
|
complete -c dust -s w -l terminal_width -d 'Specify width of output overriding the auto detection of terminal width' -r
|
||||||
|
complete -c dust -s o -l output-format -d 'Changes output display size. si will print sizes in powers of 1000. b k m g t kb mb gb tb will print the whole tree in that size.' -r -f -a "{si '',b '',k '',m '',g '',t '',kb '',mb '',gb '',tb ''}"
|
||||||
complete -c dust -s S -l stack-size -d 'Specify memory to use as stack size - use if you see: \'fatal runtime error: stack overflow\' (default low memory=1048576, high memory=1073741824)' -r
|
complete -c dust -s S -l stack-size -d 'Specify memory to use as stack size - use if you see: \'fatal runtime error: stack overflow\' (default low memory=1048576, high memory=1073741824)' -r
|
||||||
|
complete -c dust -s M -l mtime -d '+/-n matches files modified more/less than n days ago , and n matches files modified exactly n days ago, days are rounded down.That is +n => (−∞, curr−(n+1)), n => [curr−(n+1), curr−n), and -n => (𝑐𝑢𝑟𝑟−𝑛, +∞)' -r
|
||||||
|
complete -c dust -s A -l atime -d 'just like -mtime, but based on file access time' -r
|
||||||
|
complete -c dust -s y -l ctime -d 'just like -mtime, but based on file change time' -r
|
||||||
complete -c dust -s p -l full-paths -d 'Subdirectories will not have their path shortened'
|
complete -c dust -s p -l full-paths -d 'Subdirectories will not have their path shortened'
|
||||||
complete -c dust -s L -l dereference-links -d 'dereference sym links - Treat sym links as directories and go into them'
|
complete -c dust -s L -l dereference-links -d 'dereference sym links - Treat sym links as directories and go into them'
|
||||||
complete -c dust -s x -l limit-filesystem -d 'Only count the files and directories on the same filesystem as the supplied directory'
|
complete -c dust -s x -l limit-filesystem -d 'Only count the files and directories on the same filesystem as the supplied directory'
|
||||||
complete -c dust -s s -l apparent-size -d 'Use file length instead of blocks'
|
complete -c dust -s s -l apparent-size -d 'Use file length instead of blocks'
|
||||||
complete -c dust -s r -l reverse -d 'Print tree upside down (biggest highest)'
|
complete -c dust -s r -l reverse -d 'Print tree upside down (biggest highest)'
|
||||||
complete -c dust -s c -l no-colors -d 'No colors will be printed (Useful for commands like: watch)'
|
complete -c dust -s c -l no-colors -d 'No colors will be printed (Useful for commands like: watch)'
|
||||||
|
complete -c dust -s C -l force-colors -d 'Force colors print'
|
||||||
complete -c dust -s b -l no-percent-bars -d 'No percent bars or percentages will be displayed'
|
complete -c dust -s b -l no-percent-bars -d 'No percent bars or percentages will be displayed'
|
||||||
complete -c dust -s B -l bars-on-right -d 'percent bars moved to right side of screen'
|
complete -c dust -s B -l bars-on-right -d 'percent bars moved to right side of screen'
|
||||||
complete -c dust -s R -l screen-reader -d 'For screen readers. Removes bars. Adds new column: depth level (May want to use -p too for full path)'
|
complete -c dust -s R -l screen-reader -d 'For screen readers. Removes bars. Adds new column: depth level (May want to use -p too for full path)'
|
||||||
@@ -20,9 +26,10 @@ complete -c dust -l skip-total -d 'No total row will be displayed'
|
|||||||
complete -c dust -s f -l filecount -d 'Directory \'size\' is number of child files instead of disk size'
|
complete -c dust -s f -l filecount -d 'Directory \'size\' is number of child files instead of disk size'
|
||||||
complete -c dust -s i -l ignore_hidden -d 'Do not display hidden files'
|
complete -c dust -s i -l ignore_hidden -d 'Do not display hidden files'
|
||||||
complete -c dust -s t -l file_types -d 'show only these file types'
|
complete -c dust -s t -l file_types -d 'show only these file types'
|
||||||
complete -c dust -s H -l si -d 'print sizes in powers of 1000 (e.g., 1.1G)'
|
|
||||||
complete -c dust -s P -l no-progress -d 'Disable the progress indication.'
|
complete -c dust -s P -l no-progress -d 'Disable the progress indication.'
|
||||||
|
complete -c dust -l print-errors -d 'Print path with errors.'
|
||||||
complete -c dust -s D -l only-dir -d 'Only directories will be displayed.'
|
complete -c dust -s D -l only-dir -d 'Only directories will be displayed.'
|
||||||
complete -c dust -s F -l only-file -d 'Only files will be displayed. (Finds your largest files)'
|
complete -c dust -s F -l only-file -d 'Only files will be displayed. (Finds your largest files)'
|
||||||
|
complete -c dust -s j -l output-json -d 'Output the directory tree as json to the current directory'
|
||||||
complete -c dust -s h -l help -d 'Print help'
|
complete -c dust -s h -l help -d 'Print help'
|
||||||
complete -c dust -s V -l version -d 'Print version'
|
complete -c dust -s V -l version -d 'Print version'
|
||||||
|
|||||||
+41
-16
@@ -1,27 +1,30 @@
|
|||||||
.ie \n(.g .ds Aq \(aq
|
.ie \n(.g .ds Aq \(aq
|
||||||
.el .ds Aq '
|
.el .ds Aq '
|
||||||
.TH Dust 1 "Dust 0.9.0"
|
.TH Dust 1 "Dust 1.0.0"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Dust \- Like du but more intuitive
|
Dust \- Like du but more intuitive
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fBdust\fR [\fB\-d\fR|\fB\-\-depth\fR] [\fB\-n\fR|\fB\-\-number\-of\-lines\fR] [\fB\-p\fR|\fB\-\-full\-paths\fR] [\fB\-X\fR|\fB\-\-ignore\-directory\fR] [\fB\-I\fR|\fB\-\-ignore\-all\-in\-file\fR] [\fB\-L\fR|\fB\-\-dereference\-links\fR] [\fB\-x\fR|\fB\-\-limit\-filesystem\fR] [\fB\-s\fR|\fB\-\-apparent\-size\fR] [\fB\-r\fR|\fB\-\-reverse\fR] [\fB\-c\fR|\fB\-\-no\-colors\fR] [\fB\-b\fR|\fB\-\-no\-percent\-bars\fR] [\fB\-B\fR|\fB\-\-bars\-on\-right\fR] [\fB\-z\fR|\fB\-\-min\-size\fR] [\fB\-R\fR|\fB\-\-screen\-reader\fR] [\fB\-\-skip\-total\fR] [\fB\-f\fR|\fB\-\-filecount\fR] [\fB\-i\fR|\fB\-\-ignore_hidden\fR] [\fB\-v\fR|\fB\-\-invert\-filter\fR] [\fB\-e\fR|\fB\-\-filter\fR] [\fB\-t\fR|\fB\-\-file_types\fR] [\fB\-w\fR|\fB\-\-terminal_width\fR] [\fB\-H\fR|\fB\-\-si\fR] [\fB\-P\fR|\fB\-\-no\-progress\fR] [\fB\-D\fR|\fB\-\-only\-dir\fR] [\fB\-F\fR|\fB\-\-only\-file\fR] [\fB\-S\fR|\fB\-\-stack\-size\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fIparams\fR]
|
\fBdust\fR [\fB\-d\fR|\fB\-\-depth\fR] [\fB\-T\fR|\fB\-\-threads\fR] [\fB\-n\fR|\fB\-\-number\-of\-lines\fR] [\fB\-p\fR|\fB\-\-full\-paths\fR] [\fB\-X\fR|\fB\-\-ignore\-directory\fR] [\fB\-I\fR|\fB\-\-ignore\-all\-in\-file\fR] [\fB\-L\fR|\fB\-\-dereference\-links\fR] [\fB\-x\fR|\fB\-\-limit\-filesystem\fR] [\fB\-s\fR|\fB\-\-apparent\-size\fR] [\fB\-r\fR|\fB\-\-reverse\fR] [\fB\-c\fR|\fB\-\-no\-colors\fR] [\fB\-C\fR|\fB\-\-force\-colors\fR] [\fB\-b\fR|\fB\-\-no\-percent\-bars\fR] [\fB\-B\fR|\fB\-\-bars\-on\-right\fR] [\fB\-z\fR|\fB\-\-min\-size\fR] [\fB\-R\fR|\fB\-\-screen\-reader\fR] [\fB\-\-skip\-total\fR] [\fB\-f\fR|\fB\-\-filecount\fR] [\fB\-i\fR|\fB\-\-ignore_hidden\fR] [\fB\-v\fR|\fB\-\-invert\-filter\fR] [\fB\-e\fR|\fB\-\-filter\fR] [\fB\-t\fR|\fB\-\-file_types\fR] [\fB\-w\fR|\fB\-\-terminal_width\fR] [\fB\-P\fR|\fB\-\-no\-progress\fR] [\fB\-\-print\-errors\fR] [\fB\-D\fR|\fB\-\-only\-dir\fR] [\fB\-F\fR|\fB\-\-only\-file\fR] [\fB\-o\fR|\fB\-\-output\-format\fR] [\fB\-S\fR|\fB\-\-stack\-size\fR] [\fB\-j\fR|\fB\-\-output\-json\fR] [\fB\-M\fR|\fB\-\-mtime\fR] [\fB\-A\fR|\fB\-\-atime\fR] [\fB\-y\fR|\fB\-\-ctime\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fIPATH\fR]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Like du but more intuitive
|
Like du but more intuitive
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
\fB\-d\fR, \fB\-\-depth\fR
|
\fB\-d\fR, \fB\-\-depth\fR=\fIDEPTH\fR
|
||||||
Depth to show
|
Depth to show
|
||||||
.TP
|
.TP
|
||||||
\fB\-n\fR, \fB\-\-number\-of\-lines\fR
|
\fB\-T\fR, \fB\-\-threads\fR
|
||||||
|
Number of threads to use
|
||||||
|
.TP
|
||||||
|
\fB\-n\fR, \fB\-\-number\-of\-lines\fR=\fINUMBER\fR
|
||||||
Number of lines of output to show. (Default is terminal_height \- 10)
|
Number of lines of output to show. (Default is terminal_height \- 10)
|
||||||
.TP
|
.TP
|
||||||
\fB\-p\fR, \fB\-\-full\-paths\fR
|
\fB\-p\fR, \fB\-\-full\-paths\fR
|
||||||
Subdirectories will not have their path shortened
|
Subdirectories will not have their path shortened
|
||||||
.TP
|
.TP
|
||||||
\fB\-X\fR, \fB\-\-ignore\-directory\fR
|
\fB\-X\fR, \fB\-\-ignore\-directory\fR=\fIPATH\fR
|
||||||
Exclude any file or directory with this name
|
Exclude any file or directory with this name
|
||||||
.TP
|
.TP
|
||||||
\fB\-I\fR, \fB\-\-ignore\-all\-in\-file\fR
|
\fB\-I\fR, \fB\-\-ignore\-all\-in\-file\fR=\fIFILE\fR
|
||||||
Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by \-\-invert_filter
|
Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by \-\-invert_filter
|
||||||
.TP
|
.TP
|
||||||
\fB\-L\fR, \fB\-\-dereference\-links\fR
|
\fB\-L\fR, \fB\-\-dereference\-links\fR
|
||||||
@@ -39,13 +42,16 @@ Print tree upside down (biggest highest)
|
|||||||
\fB\-c\fR, \fB\-\-no\-colors\fR
|
\fB\-c\fR, \fB\-\-no\-colors\fR
|
||||||
No colors will be printed (Useful for commands like: watch)
|
No colors will be printed (Useful for commands like: watch)
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-C\fR, \fB\-\-force\-colors\fR
|
||||||
|
Force colors print
|
||||||
|
.TP
|
||||||
\fB\-b\fR, \fB\-\-no\-percent\-bars\fR
|
\fB\-b\fR, \fB\-\-no\-percent\-bars\fR
|
||||||
No percent bars or percentages will be displayed
|
No percent bars or percentages will be displayed
|
||||||
.TP
|
.TP
|
||||||
\fB\-B\fR, \fB\-\-bars\-on\-right\fR
|
\fB\-B\fR, \fB\-\-bars\-on\-right\fR
|
||||||
percent bars moved to right side of screen
|
percent bars moved to right side of screen
|
||||||
.TP
|
.TP
|
||||||
\fB\-z\fR, \fB\-\-min\-size\fR
|
\fB\-z\fR, \fB\-\-min\-size\fR=\fIMIN_SIZE\fR
|
||||||
Minimum size file to include in output
|
Minimum size file to include in output
|
||||||
.TP
|
.TP
|
||||||
\fB\-R\fR, \fB\-\-screen\-reader\fR
|
\fB\-R\fR, \fB\-\-screen\-reader\fR
|
||||||
@@ -60,40 +66,59 @@ Directory \*(Aqsize\*(Aq is number of child files instead of disk size
|
|||||||
\fB\-i\fR, \fB\-\-ignore_hidden\fR
|
\fB\-i\fR, \fB\-\-ignore_hidden\fR
|
||||||
Do not display hidden files
|
Do not display hidden files
|
||||||
.TP
|
.TP
|
||||||
\fB\-v\fR, \fB\-\-invert\-filter\fR
|
\fB\-v\fR, \fB\-\-invert\-filter\fR=\fIREGEX\fR
|
||||||
Exclude filepaths matching this regex. To ignore png files type: \-v "\\.png$"
|
Exclude filepaths matching this regex. To ignore png files type: \-v "\\.png$"
|
||||||
.TP
|
.TP
|
||||||
\fB\-e\fR, \fB\-\-filter\fR
|
\fB\-e\fR, \fB\-\-filter\fR=\fIREGEX\fR
|
||||||
Only include filepaths matching this regex. For png files type: \-e "\\.png$"
|
Only include filepaths matching this regex. For png files type: \-e "\\.png$"
|
||||||
.TP
|
.TP
|
||||||
\fB\-t\fR, \fB\-\-file_types\fR
|
\fB\-t\fR, \fB\-\-file_types\fR
|
||||||
show only these file types
|
show only these file types
|
||||||
.TP
|
.TP
|
||||||
\fB\-w\fR, \fB\-\-terminal_width\fR
|
\fB\-w\fR, \fB\-\-terminal_width\fR=\fIWIDTH\fR
|
||||||
Specify width of output overriding the auto detection of terminal width
|
Specify width of output overriding the auto detection of terminal width
|
||||||
.TP
|
.TP
|
||||||
\fB\-H\fR, \fB\-\-si\fR
|
|
||||||
print sizes in powers of 1000 (e.g., 1.1G)
|
|
||||||
.TP
|
|
||||||
\fB\-P\fR, \fB\-\-no\-progress\fR
|
\fB\-P\fR, \fB\-\-no\-progress\fR
|
||||||
Disable the progress indication.
|
Disable the progress indication.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-\-print\-errors\fR
|
||||||
|
Print path with errors.
|
||||||
|
.TP
|
||||||
\fB\-D\fR, \fB\-\-only\-dir\fR
|
\fB\-D\fR, \fB\-\-only\-dir\fR
|
||||||
Only directories will be displayed.
|
Only directories will be displayed.
|
||||||
.TP
|
.TP
|
||||||
\fB\-F\fR, \fB\-\-only\-file\fR
|
\fB\-F\fR, \fB\-\-only\-file\fR
|
||||||
Only files will be displayed. (Finds your largest files)
|
Only files will be displayed. (Finds your largest files)
|
||||||
.TP
|
.TP
|
||||||
\fB\-S\fR, \fB\-\-stack\-size\fR
|
\fB\-o\fR, \fB\-\-output\-format\fR=\fIFORMAT\fR
|
||||||
|
Changes output display size. si will print sizes in powers of 1000. b k m g t kb mb gb tb will print the whole tree in that size.
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
[\fIpossible values: \fRsi, b, k, m, g, t, kb, mb, gb, tb]
|
||||||
|
.TP
|
||||||
|
\fB\-S\fR, \fB\-\-stack\-size\fR=\fISTACK_SIZE\fR
|
||||||
Specify memory to use as stack size \- use if you see: \*(Aqfatal runtime error: stack overflow\*(Aq (default low memory=1048576, high memory=1073741824)
|
Specify memory to use as stack size \- use if you see: \*(Aqfatal runtime error: stack overflow\*(Aq (default low memory=1048576, high memory=1073741824)
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-j\fR, \fB\-\-output\-json\fR
|
||||||
|
Output the directory tree as json to the current directory
|
||||||
|
.TP
|
||||||
|
\fB\-M\fR, \fB\-\-mtime\fR
|
||||||
|
+/\-n matches files modified more/less than n days ago , and n matches files modified exactly n days ago, days are rounded down.That is +n => (−∞, curr−(n+1)), n => [curr−(n+1), curr−n), and \-n => (𝑐𝑢𝑟𝑟−𝑛, +∞)
|
||||||
|
.TP
|
||||||
|
\fB\-A\fR, \fB\-\-atime\fR
|
||||||
|
just like \-mtime, but based on file access time
|
||||||
|
.TP
|
||||||
|
\fB\-y\fR, \fB\-\-ctime\fR
|
||||||
|
just like \-mtime, but based on file change time
|
||||||
|
.TP
|
||||||
\fB\-h\fR, \fB\-\-help\fR
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
Print help
|
Print help
|
||||||
.TP
|
.TP
|
||||||
\fB\-V\fR, \fB\-\-version\fR
|
\fB\-V\fR, \fB\-\-version\fR
|
||||||
Print version
|
Print version
|
||||||
.TP
|
.TP
|
||||||
[\fIparams\fR]
|
[\fIPATH\fR]
|
||||||
|
|
||||||
.SH VERSION
|
.SH VERSION
|
||||||
v0.9.0
|
v1.0.0
|
||||||
|
|||||||
+96
-13
@@ -1,4 +1,4 @@
|
|||||||
use clap::{value_parser, Arg, Command};
|
use clap::{builder::PossibleValue, value_parser, Arg, Command};
|
||||||
|
|
||||||
// For single thread mode set this variable on your command line:
|
// For single thread mode set this variable on your command line:
|
||||||
// export RAYON_NUM_THREADS=1
|
// export RAYON_NUM_THREADS=1
|
||||||
@@ -7,19 +7,28 @@ pub fn build_cli() -> Command {
|
|||||||
Command::new("Dust")
|
Command::new("Dust")
|
||||||
.about("Like du but more intuitive")
|
.about("Like du but more intuitive")
|
||||||
.version(env!("CARGO_PKG_VERSION"))
|
.version(env!("CARGO_PKG_VERSION"))
|
||||||
.trailing_var_arg(true)
|
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("depth")
|
Arg::new("depth")
|
||||||
.short('d')
|
.short('d')
|
||||||
.long("depth")
|
.long("depth")
|
||||||
|
.value_name("DEPTH")
|
||||||
.value_parser(value_parser!(usize))
|
.value_parser(value_parser!(usize))
|
||||||
.help("Depth to show")
|
.help("Depth to show")
|
||||||
.num_args(1)
|
.num_args(1)
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("threads")
|
||||||
|
.short('T')
|
||||||
|
.long("threads")
|
||||||
|
.value_parser(value_parser!(usize))
|
||||||
|
.help("Number of threads to use")
|
||||||
|
.num_args(1)
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("number_of_lines")
|
Arg::new("number_of_lines")
|
||||||
.short('n')
|
.short('n')
|
||||||
.long("number-of-lines")
|
.long("number-of-lines")
|
||||||
|
.value_name("NUMBER")
|
||||||
.value_parser(value_parser!(usize))
|
.value_parser(value_parser!(usize))
|
||||||
.help("Number of lines of output to show. (Default is terminal_height - 10)")
|
.help("Number of lines of output to show. (Default is terminal_height - 10)")
|
||||||
.num_args(1)
|
.num_args(1)
|
||||||
@@ -35,6 +44,8 @@ pub fn build_cli() -> Command {
|
|||||||
Arg::new("ignore_directory")
|
Arg::new("ignore_directory")
|
||||||
.short('X')
|
.short('X')
|
||||||
.long("ignore-directory")
|
.long("ignore-directory")
|
||||||
|
.value_name("PATH")
|
||||||
|
.value_hint(clap::ValueHint::AnyPath)
|
||||||
.action(clap::ArgAction::Append)
|
.action(clap::ArgAction::Append)
|
||||||
.help("Exclude any file or directory with this name"),
|
.help("Exclude any file or directory with this name"),
|
||||||
)
|
)
|
||||||
@@ -42,6 +53,8 @@ pub fn build_cli() -> Command {
|
|||||||
Arg::new("ignore_all_in_file")
|
Arg::new("ignore_all_in_file")
|
||||||
.short('I')
|
.short('I')
|
||||||
.long("ignore-all-in-file")
|
.long("ignore-all-in-file")
|
||||||
|
.value_name("FILE")
|
||||||
|
.value_hint(clap::ValueHint::FilePath)
|
||||||
.value_parser(value_parser!(String))
|
.value_parser(value_parser!(String))
|
||||||
.help("Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter"),
|
.help("Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter"),
|
||||||
)
|
)
|
||||||
@@ -80,6 +93,13 @@ pub fn build_cli() -> Command {
|
|||||||
.action(clap::ArgAction::SetTrue)
|
.action(clap::ArgAction::SetTrue)
|
||||||
.help("No colors will be printed (Useful for commands like: watch)"),
|
.help("No colors will be printed (Useful for commands like: watch)"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("force_colors")
|
||||||
|
.short('C')
|
||||||
|
.long("force-colors")
|
||||||
|
.action(clap::ArgAction::SetTrue)
|
||||||
|
.help("Force colors print"),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("no_bars")
|
Arg::new("no_bars")
|
||||||
.short('b')
|
.short('b')
|
||||||
@@ -98,6 +118,7 @@ pub fn build_cli() -> Command {
|
|||||||
Arg::new("min_size")
|
Arg::new("min_size")
|
||||||
.short('z')
|
.short('z')
|
||||||
.long("min-size")
|
.long("min-size")
|
||||||
|
.value_name("MIN_SIZE")
|
||||||
.num_args(1)
|
.num_args(1)
|
||||||
.help("Minimum size file to include in output"),
|
.help("Minimum size file to include in output"),
|
||||||
)
|
)
|
||||||
@@ -132,6 +153,7 @@ pub fn build_cli() -> Command {
|
|||||||
Arg::new("invert_filter")
|
Arg::new("invert_filter")
|
||||||
.short('v')
|
.short('v')
|
||||||
.long("invert-filter")
|
.long("invert-filter")
|
||||||
|
.value_name("REGEX")
|
||||||
.action(clap::ArgAction::Append)
|
.action(clap::ArgAction::Append)
|
||||||
.conflicts_with("filter")
|
.conflicts_with("filter")
|
||||||
.conflicts_with("types")
|
.conflicts_with("types")
|
||||||
@@ -141,6 +163,7 @@ pub fn build_cli() -> Command {
|
|||||||
Arg::new("filter")
|
Arg::new("filter")
|
||||||
.short('e')
|
.short('e')
|
||||||
.long("filter")
|
.long("filter")
|
||||||
|
.value_name("REGEX")
|
||||||
.action(clap::ArgAction::Append)
|
.action(clap::ArgAction::Append)
|
||||||
.conflicts_with("types")
|
.conflicts_with("types")
|
||||||
.help("Only include filepaths matching this regex. For png files type: -e \"\\.png$\" "),
|
.help("Only include filepaths matching this regex. For png files type: -e \"\\.png$\" "),
|
||||||
@@ -158,17 +181,11 @@ pub fn build_cli() -> Command {
|
|||||||
Arg::new("width")
|
Arg::new("width")
|
||||||
.short('w')
|
.short('w')
|
||||||
.long("terminal_width")
|
.long("terminal_width")
|
||||||
.num_args(1)
|
.value_name("WIDTH")
|
||||||
.value_parser(value_parser!(usize))
|
.value_parser(value_parser!(usize))
|
||||||
|
.num_args(1)
|
||||||
.help("Specify width of output overriding the auto detection of terminal width"),
|
.help("Specify width of output overriding the auto detection of terminal width"),
|
||||||
)
|
)
|
||||||
.arg(
|
|
||||||
Arg::new("iso")
|
|
||||||
.short('H')
|
|
||||||
.long("si")
|
|
||||||
.action(clap::ArgAction::SetTrue)
|
|
||||||
.help("print sizes in powers of 1000 (e.g., 1.1G)")
|
|
||||||
)
|
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("disable_progress")
|
Arg::new("disable_progress")
|
||||||
.short('P')
|
.short('P')
|
||||||
@@ -176,6 +193,12 @@ pub fn build_cli() -> Command {
|
|||||||
.action(clap::ArgAction::SetTrue)
|
.action(clap::ArgAction::SetTrue)
|
||||||
.help("Disable the progress indication."),
|
.help("Disable the progress indication."),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("print_errors")
|
||||||
|
.long("print-errors")
|
||||||
|
.action(clap::ArgAction::SetTrue)
|
||||||
|
.help("Print path with errors."),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("only_dir")
|
Arg::new("only_dir")
|
||||||
.short('D')
|
.short('D')
|
||||||
@@ -193,14 +216,74 @@ pub fn build_cli() -> Command {
|
|||||||
.action(clap::ArgAction::SetTrue)
|
.action(clap::ArgAction::SetTrue)
|
||||||
.help("Only files will be displayed. (Finds your largest files)"),
|
.help("Only files will be displayed. (Finds your largest files)"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("output_format")
|
||||||
|
.short('o')
|
||||||
|
.long("output-format")
|
||||||
|
.value_name("FORMAT")
|
||||||
|
.value_parser([
|
||||||
|
PossibleValue::new("si"),
|
||||||
|
PossibleValue::new("b"),
|
||||||
|
PossibleValue::new("k").alias("kib"),
|
||||||
|
PossibleValue::new("m").alias("mib"),
|
||||||
|
PossibleValue::new("g").alias("gib"),
|
||||||
|
PossibleValue::new("t").alias("tib"),
|
||||||
|
PossibleValue::new("kb"),
|
||||||
|
PossibleValue::new("mb"),
|
||||||
|
PossibleValue::new("gb"),
|
||||||
|
PossibleValue::new("tb"),
|
||||||
|
])
|
||||||
|
.ignore_case(true)
|
||||||
|
.help("Changes output display size. si will print sizes in powers of 1000. b k m g t kb mb gb tb will print the whole tree in that size.")
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("stack_size")
|
Arg::new("stack_size")
|
||||||
.short('S')
|
.short('S')
|
||||||
.long("stack-size")
|
.long("stack-size")
|
||||||
.num_args(1)
|
.value_name("STACK_SIZE")
|
||||||
.value_parser(value_parser!(usize))
|
.value_parser(value_parser!(usize))
|
||||||
|
.num_args(1)
|
||||||
.help("Specify memory to use as stack size - use if you see: 'fatal runtime error: stack overflow' (default low memory=1048576, high memory=1073741824)"),
|
.help("Specify memory to use as stack size - use if you see: 'fatal runtime error: stack overflow' (default low memory=1048576, high memory=1073741824)"),
|
||||||
)
|
)
|
||||||
.arg(Arg::new("params").num_args(1..)
|
.arg(
|
||||||
.value_parser(value_parser!(String)))
|
Arg::new("params")
|
||||||
|
.value_name("PATH")
|
||||||
|
.value_hint(clap::ValueHint::AnyPath)
|
||||||
|
.value_parser(value_parser!(String))
|
||||||
|
.num_args(1..)
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("output_json")
|
||||||
|
.short('j')
|
||||||
|
.long("output-json")
|
||||||
|
.action(clap::ArgAction::SetTrue)
|
||||||
|
.help("Output the directory tree as json to the current directory"),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("mtime")
|
||||||
|
.short('M')
|
||||||
|
.long("mtime")
|
||||||
|
.num_args(1)
|
||||||
|
.allow_hyphen_values(true)
|
||||||
|
.value_parser(value_parser!(String))
|
||||||
|
.help("+/-n matches files modified more/less than n days ago , and n matches files modified exactly n days ago, days are rounded down.That is +n => (−∞, curr−(n+1)), n => [curr−(n+1), curr−n), and -n => (𝑐𝑢𝑟𝑟−𝑛, +∞)")
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("atime")
|
||||||
|
.short('A')
|
||||||
|
.long("atime")
|
||||||
|
.num_args(1)
|
||||||
|
.allow_hyphen_values(true)
|
||||||
|
.value_parser(value_parser!(String))
|
||||||
|
.help("just like -mtime, but based on file access time")
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("ctime")
|
||||||
|
.short('y')
|
||||||
|
.long("ctime")
|
||||||
|
.num_args(1)
|
||||||
|
.allow_hyphen_values(true)
|
||||||
|
.value_parser(value_parser!(String))
|
||||||
|
.help("just like -mtime, but based on file change time")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+148
-48
@@ -1,11 +1,16 @@
|
|||||||
|
use chrono::{Local, TimeZone};
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use config_file::FromConfigFile;
|
use config_file::FromConfigFile;
|
||||||
|
use regex::Regex;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::io::IsTerminal;
|
use std::io::IsTerminal;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::display::UNITS;
|
use crate::dir_walker::Operater;
|
||||||
|
use crate::display::get_number_format;
|
||||||
|
|
||||||
|
pub static DAY_SECONDS: i64 = 24 * 60 * 60;
|
||||||
|
|
||||||
#[derive(Deserialize, Default)]
|
#[derive(Deserialize, Default)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
@@ -15,11 +20,12 @@ pub struct Config {
|
|||||||
pub display_apparent_size: Option<bool>,
|
pub display_apparent_size: Option<bool>,
|
||||||
pub reverse: Option<bool>,
|
pub reverse: Option<bool>,
|
||||||
pub no_colors: Option<bool>,
|
pub no_colors: Option<bool>,
|
||||||
|
pub force_colors: Option<bool>,
|
||||||
pub no_bars: Option<bool>,
|
pub no_bars: Option<bool>,
|
||||||
pub skip_total: Option<bool>,
|
pub skip_total: Option<bool>,
|
||||||
pub screen_reader: Option<bool>,
|
pub screen_reader: Option<bool>,
|
||||||
pub ignore_hidden: Option<bool>,
|
pub ignore_hidden: Option<bool>,
|
||||||
pub iso: Option<bool>,
|
pub output_format: Option<String>,
|
||||||
pub min_size: Option<String>,
|
pub min_size: Option<String>,
|
||||||
pub only_dir: Option<bool>,
|
pub only_dir: Option<bool>,
|
||||||
pub only_file: Option<bool>,
|
pub only_file: Option<bool>,
|
||||||
@@ -27,12 +33,18 @@ pub struct Config {
|
|||||||
pub depth: Option<usize>,
|
pub depth: Option<usize>,
|
||||||
pub bars_on_right: Option<bool>,
|
pub bars_on_right: Option<bool>,
|
||||||
pub stack_size: Option<usize>,
|
pub stack_size: Option<usize>,
|
||||||
|
pub threads: Option<usize>,
|
||||||
|
pub output_json: Option<bool>,
|
||||||
|
pub print_errors: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn get_no_colors(&self, options: &ArgMatches) -> bool {
|
pub fn get_no_colors(&self, options: &ArgMatches) -> bool {
|
||||||
Some(true) == self.no_colors || options.get_flag("no_colors")
|
Some(true) == self.no_colors || options.get_flag("no_colors")
|
||||||
}
|
}
|
||||||
|
pub fn get_force_colors(&self, options: &ArgMatches) -> bool {
|
||||||
|
Some(true) == self.force_colors || options.get_flag("force_colors")
|
||||||
|
}
|
||||||
pub fn get_disable_progress(&self, options: &ArgMatches) -> bool {
|
pub fn get_disable_progress(&self, options: &ArgMatches) -> bool {
|
||||||
Some(true) == self.disable_progress
|
Some(true) == self.disable_progress
|
||||||
|| options.get_flag("disable_progress")
|
|| options.get_flag("disable_progress")
|
||||||
@@ -45,10 +57,7 @@ impl Config {
|
|||||||
Some(true) == self.ignore_hidden || options.get_flag("ignore_hidden")
|
Some(true) == self.ignore_hidden || options.get_flag("ignore_hidden")
|
||||||
}
|
}
|
||||||
pub fn get_full_paths(&self, options: &ArgMatches) -> bool {
|
pub fn get_full_paths(&self, options: &ArgMatches) -> bool {
|
||||||
// If we are only showing files, always show full paths
|
Some(true) == self.display_full_paths || options.get_flag("display_full_paths")
|
||||||
Some(true) == self.display_full_paths
|
|
||||||
|| options.get_flag("display_full_paths")
|
|
||||||
|| self.get_only_file(options)
|
|
||||||
}
|
}
|
||||||
pub fn get_reverse(&self, options: &ArgMatches) -> bool {
|
pub fn get_reverse(&self, options: &ArgMatches) -> bool {
|
||||||
Some(true) == self.reverse || options.get_flag("reverse")
|
Some(true) == self.reverse || options.get_flag("reverse")
|
||||||
@@ -56,8 +65,16 @@ impl Config {
|
|||||||
pub fn get_no_bars(&self, options: &ArgMatches) -> bool {
|
pub fn get_no_bars(&self, options: &ArgMatches) -> bool {
|
||||||
Some(true) == self.no_bars || options.get_flag("no_bars")
|
Some(true) == self.no_bars || options.get_flag("no_bars")
|
||||||
}
|
}
|
||||||
pub fn get_iso(&self, options: &ArgMatches) -> bool {
|
pub fn get_output_format(&self, options: &ArgMatches) -> String {
|
||||||
Some(true) == self.iso || options.get_flag("iso")
|
let out_fmt = options.get_one::<String>("output_format");
|
||||||
|
(match out_fmt {
|
||||||
|
None => match &self.output_format {
|
||||||
|
None => "".to_string(),
|
||||||
|
Some(x) => x.to_string(),
|
||||||
|
},
|
||||||
|
Some(x) => x.into(),
|
||||||
|
})
|
||||||
|
.to_lowercase()
|
||||||
}
|
}
|
||||||
pub fn get_skip_total(&self, options: &ArgMatches) -> bool {
|
pub fn get_skip_total(&self, options: &ArgMatches) -> bool {
|
||||||
Some(true) == self.skip_total || options.get_flag("skip_total")
|
Some(true) == self.skip_total || options.get_flag("skip_total")
|
||||||
@@ -72,17 +89,17 @@ impl Config {
|
|||||||
|
|
||||||
self.depth.unwrap_or(usize::MAX)
|
self.depth.unwrap_or(usize::MAX)
|
||||||
}
|
}
|
||||||
pub fn get_min_size(&self, options: &ArgMatches, iso: bool) -> Option<usize> {
|
pub fn get_min_size(&self, options: &ArgMatches) -> Option<usize> {
|
||||||
let size_from_param = options.get_one::<String>("min_size");
|
let size_from_param = options.get_one::<String>("min_size");
|
||||||
self._get_min_size(size_from_param, iso)
|
self._get_min_size(size_from_param)
|
||||||
}
|
}
|
||||||
fn _get_min_size(&self, min_size: Option<&String>, iso: bool) -> Option<usize> {
|
fn _get_min_size(&self, min_size: Option<&String>) -> Option<usize> {
|
||||||
let size_from_param = min_size.and_then(|a| convert_min_size(a, iso));
|
let size_from_param = min_size.and_then(|a| convert_min_size(a));
|
||||||
|
|
||||||
if size_from_param.is_none() {
|
if size_from_param.is_none() {
|
||||||
self.min_size
|
self.min_size
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|a| convert_min_size(a.as_ref(), iso))
|
.and_then(|a| convert_min_size(a.as_ref()))
|
||||||
} else {
|
} else {
|
||||||
size_from_param
|
size_from_param
|
||||||
}
|
}
|
||||||
@@ -90,6 +107,10 @@ impl Config {
|
|||||||
pub fn get_only_dir(&self, options: &ArgMatches) -> bool {
|
pub fn get_only_dir(&self, options: &ArgMatches) -> bool {
|
||||||
Some(true) == self.only_dir || options.get_flag("only_dir")
|
Some(true) == self.only_dir || options.get_flag("only_dir")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_print_errors(&self, options: &ArgMatches) -> bool {
|
||||||
|
Some(true) == self.print_errors || options.get_flag("print_errors")
|
||||||
|
}
|
||||||
pub fn get_only_file(&self, options: &ArgMatches) -> bool {
|
pub fn get_only_file(&self, options: &ArgMatches) -> bool {
|
||||||
Some(true) == self.only_file || options.get_flag("only_file")
|
Some(true) == self.only_file || options.get_flag("only_file")
|
||||||
}
|
}
|
||||||
@@ -104,38 +125,102 @@ impl Config {
|
|||||||
from_cmd_line.copied()
|
from_cmd_line.copied()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn get_threads(&self, options: &ArgMatches) -> Option<usize> {
|
||||||
|
let from_cmd_line = options.get_one::<usize>("threads");
|
||||||
|
if from_cmd_line.is_none() {
|
||||||
|
self.threads
|
||||||
|
} else {
|
||||||
|
from_cmd_line.copied()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn get_output_json(&self, options: &ArgMatches) -> bool {
|
||||||
|
Some(true) == self.output_json || options.get_flag("output_json")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_modified_time_operator(&self, options: &ArgMatches) -> (Operater, i64) {
|
||||||
|
get_filter_time_operator(
|
||||||
|
options.get_one::<String>("mtime"),
|
||||||
|
get_current_date_epoch_seconds(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_accessed_time_operator(&self, options: &ArgMatches) -> (Operater, i64) {
|
||||||
|
get_filter_time_operator(
|
||||||
|
options.get_one::<String>("atime"),
|
||||||
|
get_current_date_epoch_seconds(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_created_time_operator(&self, options: &ArgMatches) -> (Operater, i64) {
|
||||||
|
get_filter_time_operator(
|
||||||
|
options.get_one::<String>("ctime"),
|
||||||
|
get_current_date_epoch_seconds(),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_min_size(input: &str, iso: bool) -> Option<usize> {
|
fn get_current_date_epoch_seconds() -> i64 {
|
||||||
let chars_as_vec: Vec<char> = input.chars().collect();
|
// calcurate current date epoch seconds
|
||||||
match chars_as_vec.split_last() {
|
let now = Local::now();
|
||||||
Some((last, start)) => {
|
let current_date = now.date_naive();
|
||||||
let mut starts: String = start.iter().collect::<String>();
|
|
||||||
|
|
||||||
for (i, u) in UNITS.iter().rev().enumerate() {
|
let current_date_time = current_date.and_hms_opt(0, 0, 0).unwrap();
|
||||||
if Some(*u) == last.to_uppercase().next() {
|
Local
|
||||||
return match starts.parse::<usize>() {
|
.from_local_datetime(¤t_date_time)
|
||||||
Ok(pure) => {
|
.unwrap()
|
||||||
let num: usize = if iso { 1000 } else { 1024 };
|
.timestamp()
|
||||||
let marker = pure * num.pow((i + 1) as u32);
|
}
|
||||||
Some(marker)
|
|
||||||
}
|
fn get_filter_time_operator(
|
||||||
Err(_) => {
|
option_value: Option<&String>,
|
||||||
|
current_date_epoch_seconds: i64,
|
||||||
|
) -> (Operater, i64) {
|
||||||
|
match option_value {
|
||||||
|
Some(val) => {
|
||||||
|
let time = current_date_epoch_seconds
|
||||||
|
- val
|
||||||
|
.parse::<i64>()
|
||||||
|
.unwrap_or_else(|_| panic!("invalid data format"))
|
||||||
|
.abs()
|
||||||
|
* DAY_SECONDS;
|
||||||
|
match val.chars().next().expect("Value should not be empty") {
|
||||||
|
'+' => (Operater::LessThan, time - DAY_SECONDS),
|
||||||
|
'-' => (Operater::GreaterThan, time),
|
||||||
|
_ => (Operater::Equal, time - DAY_SECONDS),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => (Operater::GreaterThan, 0),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn convert_min_size(input: &str) -> Option<usize> {
|
||||||
|
let re = Regex::new(r"([0-9]+)(\w*)").unwrap();
|
||||||
|
|
||||||
|
if let Some(cap) = re.captures(input) {
|
||||||
|
let (_, [digits, letters]) = cap.extract();
|
||||||
|
|
||||||
|
// Failure to parse should be impossible due to regex match
|
||||||
|
let digits_as_usize: Option<usize> = digits.parse().ok();
|
||||||
|
|
||||||
|
match digits_as_usize {
|
||||||
|
Some(parsed_digits) => {
|
||||||
|
let number_format = get_number_format(&letters.to_lowercase());
|
||||||
|
match number_format {
|
||||||
|
Some((multiple, _)) => Some(parsed_digits * (multiple as usize)),
|
||||||
|
None => {
|
||||||
|
if letters.eq("") {
|
||||||
|
Some(parsed_digits)
|
||||||
|
} else {
|
||||||
eprintln!("Ignoring invalid min-size: {input}");
|
eprintln!("Ignoring invalid min-size: {input}");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
starts.push(*last);
|
None => None,
|
||||||
starts
|
|
||||||
.parse()
|
|
||||||
.map_err(|_| {
|
|
||||||
eprintln!("Ignoring invalid min-size: {input}");
|
|
||||||
})
|
|
||||||
.ok()
|
|
||||||
}
|
}
|
||||||
None => None,
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,30 +250,45 @@ pub fn get_config() -> Config {
|
|||||||
mod tests {
|
mod tests {
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use chrono::{Datelike, Timelike};
|
||||||
use clap::{value_parser, Arg, ArgMatches, Command};
|
use clap::{value_parser, Arg, ArgMatches, Command};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_get_current_date_epoch_seconds() {
|
||||||
|
let epoch_seconds = get_current_date_epoch_seconds();
|
||||||
|
let dt = Local.timestamp_opt(epoch_seconds, 0).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(dt.hour(), 0);
|
||||||
|
assert_eq!(dt.minute(), 0);
|
||||||
|
assert_eq!(dt.second(), 0);
|
||||||
|
assert_eq!(dt.date_naive().day(), Local::now().date_naive().day());
|
||||||
|
assert_eq!(dt.date_naive().month(), Local::now().date_naive().month());
|
||||||
|
assert_eq!(dt.date_naive().year(), Local::now().date_naive().year());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_conversion() {
|
fn test_conversion() {
|
||||||
assert_eq!(convert_min_size("55", false), Some(55));
|
assert_eq!(convert_min_size("55"), Some(55));
|
||||||
assert_eq!(convert_min_size("12344321", false), Some(12344321));
|
assert_eq!(convert_min_size("12344321"), Some(12344321));
|
||||||
assert_eq!(convert_min_size("95RUBBISH", false), None);
|
assert_eq!(convert_min_size("95RUBBISH"), None);
|
||||||
assert_eq!(convert_min_size("10K", false), Some(10 * 1024));
|
assert_eq!(convert_min_size("10Ki"), Some(10 * 1024));
|
||||||
assert_eq!(convert_min_size("10M", false), Some(10 * 1024usize.pow(2)));
|
assert_eq!(convert_min_size("10MiB"), Some(10 * 1024usize.pow(2)));
|
||||||
assert_eq!(convert_min_size("10M", true), Some(10 * 1000usize.pow(2)));
|
assert_eq!(convert_min_size("10M"), Some(10 * 1024usize.pow(2)));
|
||||||
assert_eq!(convert_min_size("2G", false), Some(2 * 1024usize.pow(3)));
|
assert_eq!(convert_min_size("10Mb"), Some(10 * 1000usize.pow(2)));
|
||||||
|
assert_eq!(convert_min_size("2Gi"), Some(2 * 1024usize.pow(3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_min_size_from_config_applied_or_overridden() {
|
fn test_min_size_from_config_applied_or_overridden() {
|
||||||
let c = Config {
|
let c = Config {
|
||||||
min_size: Some("1K".to_owned()),
|
min_size: Some("1KiB".to_owned()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
assert_eq!(c._get_min_size(None, false), Some(1024));
|
assert_eq!(c._get_min_size(None), Some(1024));
|
||||||
assert_eq!(c._get_min_size(Some(&"2K".into()), false), Some(2048));
|
assert_eq!(c._get_min_size(Some(&"2KiB".into())), Some(2048));
|
||||||
|
|
||||||
assert_eq!(c._get_min_size(None, true), Some(1000));
|
assert_eq!(c._get_min_size(Some(&"1kb".into())), Some(1000));
|
||||||
assert_eq!(c._get_min_size(Some(&"2K".into()), true), Some(2000));
|
assert_eq!(c._get_min_size(Some(&"2KB".into())), Some(2000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+124
-57
@@ -1,3 +1,4 @@
|
|||||||
|
use std::cmp::Ordering;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
@@ -7,6 +8,7 @@ use crate::progress::Operation;
|
|||||||
use crate::progress::PAtomicInfo;
|
use crate::progress::PAtomicInfo;
|
||||||
use crate::progress::RuntimeErrors;
|
use crate::progress::RuntimeErrors;
|
||||||
use crate::progress::ORDERING;
|
use crate::progress::ORDERING;
|
||||||
|
use crate::utils::is_filtered_out_due_to_file_time;
|
||||||
use crate::utils::is_filtered_out_due_to_invert_regex;
|
use crate::utils::is_filtered_out_due_to_invert_regex;
|
||||||
use crate::utils::is_filtered_out_due_to_regex;
|
use crate::utils::is_filtered_out_due_to_regex;
|
||||||
use rayon::iter::ParallelBridge;
|
use rayon::iter::ParallelBridge;
|
||||||
@@ -20,11 +22,22 @@ use crate::node::build_node;
|
|||||||
use std::fs::DirEntry;
|
use std::fs::DirEntry;
|
||||||
|
|
||||||
use crate::platform::get_metadata;
|
use crate::platform::get_metadata;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Operater {
|
||||||
|
Equal = 0,
|
||||||
|
LessThan = 1,
|
||||||
|
GreaterThan = 2,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct WalkData<'a> {
|
pub struct WalkData<'a> {
|
||||||
pub ignore_directories: HashSet<PathBuf>,
|
pub ignore_directories: HashSet<PathBuf>,
|
||||||
pub filter_regex: &'a [Regex],
|
pub filter_regex: &'a [Regex],
|
||||||
pub invert_filter_regex: &'a [Regex],
|
pub invert_filter_regex: &'a [Regex],
|
||||||
pub allowed_filesystems: HashSet<u64>,
|
pub allowed_filesystems: HashSet<u64>,
|
||||||
|
pub filter_modified_time: (Operater, i64),
|
||||||
|
pub filter_accessed_time: (Operater, i64),
|
||||||
|
pub filter_changed_time: (Operater, i64),
|
||||||
pub use_apparent_size: bool,
|
pub use_apparent_size: bool,
|
||||||
pub by_filecount: bool,
|
pub by_filecount: bool,
|
||||||
pub ignore_hidden: bool,
|
pub ignore_hidden: bool,
|
||||||
@@ -83,29 +96,47 @@ fn clean_inodes(
|
|||||||
|
|
||||||
fn sort_by_inode(a: &Node, b: &Node) -> std::cmp::Ordering {
|
fn sort_by_inode(a: &Node, b: &Node) -> std::cmp::Ordering {
|
||||||
// Sorting by inode is quicker than by sorting by name/size
|
// Sorting by inode is quicker than by sorting by name/size
|
||||||
if let Some(x) = a.inode_device {
|
match (a.inode_device, b.inode_device) {
|
||||||
if let Some(y) = b.inode_device {
|
(Some(x), Some(y)) => {
|
||||||
if x.0 != y.0 {
|
if x.0 != y.0 {
|
||||||
return x.0.cmp(&y.0);
|
x.0.cmp(&y.0)
|
||||||
} else if x.1 != y.1 {
|
} else if x.1 != y.1 {
|
||||||
return x.1.cmp(&y.1);
|
x.1.cmp(&y.1)
|
||||||
|
} else {
|
||||||
|
a.name.cmp(&b.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
(Some(_), None) => Ordering::Greater,
|
||||||
|
(None, Some(_)) => Ordering::Less,
|
||||||
|
(None, None) => a.name.cmp(&b.name),
|
||||||
}
|
}
|
||||||
a.name.cmp(&b.name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ignore_file(entry: &DirEntry, walk_data: &WalkData) -> bool {
|
fn ignore_file(entry: &DirEntry, walk_data: &WalkData) -> bool {
|
||||||
let is_dot_file = entry.file_name().to_str().unwrap_or("").starts_with('.');
|
let is_dot_file = entry.file_name().to_str().unwrap_or("").starts_with('.');
|
||||||
let is_ignored_path = walk_data.ignore_directories.contains(&entry.path());
|
let is_ignored_path = walk_data.ignore_directories.contains(&entry.path());
|
||||||
|
|
||||||
if !walk_data.allowed_filesystems.is_empty() {
|
let size_inode_device = get_metadata(entry.path(), false);
|
||||||
let size_inode_device = get_metadata(&entry.path(), false);
|
if let Some((_size, Some((_id, dev)), (modified_time, accessed_time, changed_time))) =
|
||||||
|
size_inode_device
|
||||||
if let Some((_size, Some((_id, dev)))) = size_inode_device {
|
{
|
||||||
if !walk_data.allowed_filesystems.contains(&dev) {
|
if !walk_data.allowed_filesystems.is_empty()
|
||||||
return true;
|
&& !walk_data.allowed_filesystems.contains(&dev)
|
||||||
}
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if entry.path().is_file()
|
||||||
|
&& [
|
||||||
|
(&walk_data.filter_modified_time, modified_time),
|
||||||
|
(&walk_data.filter_accessed_time, accessed_time),
|
||||||
|
(&walk_data.filter_changed_time, changed_time),
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.any(|(filter_time, actual_time)| {
|
||||||
|
is_filtered_out_due_to_file_time(filter_time, *actual_time)
|
||||||
|
})
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +162,10 @@ fn walk(dir: PathBuf, walk_data: &WalkData, depth: usize) -> Option<Node> {
|
|||||||
let prog_data = &walk_data.progress_data;
|
let prog_data = &walk_data.progress_data;
|
||||||
let errors = &walk_data.errors;
|
let errors = &walk_data.errors;
|
||||||
|
|
||||||
|
if errors.lock().unwrap().abort {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let children = if dir.is_dir() {
|
let children = if dir.is_dir() {
|
||||||
let read_dir = fs::read_dir(&dir);
|
let read_dir = fs::read_dir(&dir);
|
||||||
match read_dir {
|
match read_dir {
|
||||||
@@ -139,44 +174,46 @@ fn walk(dir: PathBuf, walk_data: &WalkData, depth: usize) -> Option<Node> {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.par_bridge()
|
.par_bridge()
|
||||||
.filter_map(|entry| {
|
.filter_map(|entry| {
|
||||||
if let Ok(ref entry) = entry {
|
match entry {
|
||||||
// uncommenting the below line gives simpler code but
|
Ok(ref entry) => {
|
||||||
// rayon doesn't parallelize as well giving a 3X performance drop
|
// uncommenting the below line gives simpler code but
|
||||||
// hence we unravel the recursion a bit
|
// rayon doesn't parallelize as well giving a 3X performance drop
|
||||||
|
// hence we unravel the recursion a bit
|
||||||
|
|
||||||
// return walk(entry.path(), walk_data, depth)
|
// return walk(entry.path(), walk_data, depth)
|
||||||
|
|
||||||
if !ignore_file(entry, walk_data) {
|
if !ignore_file(entry, walk_data) {
|
||||||
if let Ok(data) = entry.file_type() {
|
if let Ok(data) = entry.file_type() {
|
||||||
if data.is_dir()
|
if data.is_dir()
|
||||||
|| (walk_data.follow_links && data.is_symlink())
|
|| (walk_data.follow_links && data.is_symlink())
|
||||||
{
|
{
|
||||||
return walk(entry.path(), walk_data, depth + 1);
|
return walk(entry.path(), walk_data, depth + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
let node = build_node(
|
||||||
|
entry.path(),
|
||||||
|
vec![],
|
||||||
|
data.is_symlink(),
|
||||||
|
data.is_file(),
|
||||||
|
depth,
|
||||||
|
walk_data,
|
||||||
|
);
|
||||||
|
|
||||||
|
prog_data.num_files.fetch_add(1, ORDERING);
|
||||||
|
if let Some(ref file) = node {
|
||||||
|
prog_data
|
||||||
|
.total_file_size
|
||||||
|
.fetch_add(file.size, ORDERING);
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = build_node(
|
|
||||||
entry.path(),
|
|
||||||
vec![],
|
|
||||||
walk_data.filter_regex,
|
|
||||||
walk_data.invert_filter_regex,
|
|
||||||
walk_data.use_apparent_size,
|
|
||||||
data.is_symlink(),
|
|
||||||
data.is_file(),
|
|
||||||
walk_data.by_filecount,
|
|
||||||
depth,
|
|
||||||
);
|
|
||||||
|
|
||||||
prog_data.num_files.fetch_add(1, ORDERING);
|
|
||||||
if let Some(ref file) = node {
|
|
||||||
prog_data.total_file_size.fetch_add(file.size, ORDERING);
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
Err(ref failed) => {
|
||||||
let mut editable_error = errors.lock().unwrap();
|
let mut editable_error = errors.lock().unwrap();
|
||||||
editable_error.no_permissions = true
|
editable_error.no_permissions.insert(failed.to_string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
@@ -186,7 +223,9 @@ fn walk(dir: PathBuf, walk_data: &WalkData, depth: usize) -> Option<Node> {
|
|||||||
let mut editable_error = errors.lock().unwrap();
|
let mut editable_error = errors.lock().unwrap();
|
||||||
match failed.kind() {
|
match failed.kind() {
|
||||||
std::io::ErrorKind::PermissionDenied => {
|
std::io::ErrorKind::PermissionDenied => {
|
||||||
editable_error.no_permissions = true;
|
editable_error
|
||||||
|
.no_permissions
|
||||||
|
.insert(dir.to_string_lossy().into());
|
||||||
}
|
}
|
||||||
std::io::ErrorKind::NotFound => {
|
std::io::ErrorKind::NotFound => {
|
||||||
editable_error.file_not_found.insert(failed.to_string());
|
editable_error.file_not_found.insert(failed.to_string());
|
||||||
@@ -206,20 +245,11 @@ fn walk(dir: PathBuf, walk_data: &WalkData, depth: usize) -> Option<Node> {
|
|||||||
}
|
}
|
||||||
vec![]
|
vec![]
|
||||||
};
|
};
|
||||||
build_node(
|
build_node(dir, children, false, false, depth, walk_data)
|
||||||
dir,
|
|
||||||
children,
|
|
||||||
walk_data.filter_regex,
|
|
||||||
walk_data.invert_filter_regex,
|
|
||||||
walk_data.use_apparent_size,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
walk_data.by_filecount,
|
|
||||||
depth,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
@@ -257,4 +287,41 @@ mod tests {
|
|||||||
assert_eq!(clean_inodes(n.clone(), &mut inodes, true), Some(n.clone()));
|
assert_eq!(clean_inodes(n.clone(), &mut inodes, true), Some(n.clone()));
|
||||||
assert_eq!(clean_inodes(n.clone(), &mut inodes, true), Some(n.clone()));
|
assert_eq!(clean_inodes(n.clone(), &mut inodes, true), Some(n.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_total_ordering_of_sort_by_inode() {
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
let a = Node {
|
||||||
|
name: PathBuf::from_str("a").unwrap(),
|
||||||
|
size: 0,
|
||||||
|
children: vec![],
|
||||||
|
inode_device: Some((3, 66310)),
|
||||||
|
depth: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
let b = Node {
|
||||||
|
name: PathBuf::from_str("b").unwrap(),
|
||||||
|
size: 0,
|
||||||
|
children: vec![],
|
||||||
|
inode_device: None,
|
||||||
|
depth: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
let c = Node {
|
||||||
|
name: PathBuf::from_str("c").unwrap(),
|
||||||
|
size: 0,
|
||||||
|
children: vec![],
|
||||||
|
inode_device: Some((1, 66310)),
|
||||||
|
depth: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(sort_by_inode(&a, &b), Ordering::Greater);
|
||||||
|
assert_eq!(sort_by_inode(&a, &c), Ordering::Greater);
|
||||||
|
assert_eq!(sort_by_inode(&c, &b), Ordering::Greater);
|
||||||
|
|
||||||
|
assert_eq!(sort_by_inode(&b, &a), Ordering::Less);
|
||||||
|
assert_eq!(sort_by_inode(&c, &a), Ordering::Less);
|
||||||
|
assert_eq!(sort_by_inode(&b, &c), Ordering::Less);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+85
-34
@@ -23,7 +23,7 @@ pub struct InitialDisplayData {
|
|||||||
pub colors_on: bool,
|
pub colors_on: bool,
|
||||||
pub by_filecount: bool,
|
pub by_filecount: bool,
|
||||||
pub is_screen_reader: bool,
|
pub is_screen_reader: bool,
|
||||||
pub iso: bool,
|
pub output_format: String,
|
||||||
pub bars_on_right: bool,
|
pub bars_on_right: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ pub fn draw_it(
|
|||||||
let max_size = biggest.size;
|
let max_size = biggest.size;
|
||||||
max_size.separate_with_commas().chars().count()
|
max_size.separate_with_commas().chars().count()
|
||||||
} else {
|
} else {
|
||||||
find_biggest_size_str(root_node, idd.iso)
|
find_biggest_size_str(root_node, &idd.output_format)
|
||||||
};
|
};
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
@@ -190,10 +190,12 @@ pub fn draw_it(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_biggest_size_str(node: &DisplayNode, iso: bool) -> usize {
|
fn find_biggest_size_str(node: &DisplayNode, output_format: &str) -> usize {
|
||||||
let mut mx = human_readable_number(node.size, iso).chars().count();
|
let mut mx = human_readable_number(node.size, output_format)
|
||||||
|
.chars()
|
||||||
|
.count();
|
||||||
for n in node.children.iter() {
|
for n in node.children.iter() {
|
||||||
mx = max(mx, find_biggest_size_str(n, iso));
|
mx = max(mx, find_biggest_size_str(n, output_format));
|
||||||
}
|
}
|
||||||
mx
|
mx
|
||||||
}
|
}
|
||||||
@@ -375,7 +377,7 @@ fn get_pretty_size(node: &DisplayNode, is_biggest: bool, display_data: &DisplayD
|
|||||||
let output = if display_data.initial.by_filecount {
|
let output = if display_data.initial.by_filecount {
|
||||||
node.size.separate_with_commas()
|
node.size.separate_with_commas()
|
||||||
} else {
|
} else {
|
||||||
human_readable_number(node.size, display_data.initial.iso)
|
human_readable_number(node.size, &display_data.initial.output_format)
|
||||||
};
|
};
|
||||||
let spaces_to_add = display_data.num_chars_needed_on_left_most - output.chars().count();
|
let spaces_to_add = display_data.num_chars_needed_on_left_most - output.chars().count();
|
||||||
let output = " ".repeat(spaces_to_add) + output.as_str();
|
let output = " ".repeat(spaces_to_add) + output.as_str();
|
||||||
@@ -407,19 +409,51 @@ fn get_pretty_name(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn human_readable_number(size: u64, iso: bool) -> String {
|
// If we are working with SI units or not
|
||||||
|
pub fn get_type_of_thousand(output_str: &str) -> u64 {
|
||||||
|
if output_str.is_empty() {
|
||||||
|
1024
|
||||||
|
} else if output_str == "si" {
|
||||||
|
1000
|
||||||
|
} else if output_str.contains('i') || output_str.len() == 1 {
|
||||||
|
1024
|
||||||
|
} else {
|
||||||
|
1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_number_format(output_str: &str) -> Option<(u64, char)> {
|
||||||
|
if output_str.starts_with('b') {
|
||||||
|
return Some((1, 'B'));
|
||||||
|
}
|
||||||
for (i, u) in UNITS.iter().enumerate() {
|
for (i, u) in UNITS.iter().enumerate() {
|
||||||
let num: u64 = if iso { 1000 } else { 1024 };
|
if output_str.starts_with((*u).to_ascii_lowercase()) {
|
||||||
let marker = num.pow((UNITS.len() - i) as u32);
|
let marker = get_type_of_thousand(output_str).pow((UNITS.len() - i) as u32);
|
||||||
if size >= marker {
|
return Some((marker, *u));
|
||||||
if size / marker < 10 {
|
}
|
||||||
return format!("{:.1}{}", (size as f32 / marker as f32), u);
|
}
|
||||||
} else {
|
None
|
||||||
return format!("{}{}", (size / marker), u);
|
}
|
||||||
}
|
|
||||||
|
pub fn human_readable_number(size: u64, output_str: &str) -> String {
|
||||||
|
match get_number_format(output_str) {
|
||||||
|
Some((x, u)) => {
|
||||||
|
format!("{}{}", (size / x), u)
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
for (i, u) in UNITS.iter().enumerate() {
|
||||||
|
let marker = get_type_of_thousand(output_str).pow((UNITS.len() - i) as u32);
|
||||||
|
if size >= marker {
|
||||||
|
if size / marker < 10 {
|
||||||
|
return format!("{:.1}{}", (size as f32 / marker as f32), u);
|
||||||
|
} else {
|
||||||
|
return format!("{}{}", (size / marker), u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
format!("{size}B")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
format!("{size}B")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mod tests {
|
mod tests {
|
||||||
@@ -436,7 +470,7 @@ mod tests {
|
|||||||
colors_on: false,
|
colors_on: false,
|
||||||
by_filecount: false,
|
by_filecount: false,
|
||||||
is_screen_reader: false,
|
is_screen_reader: false,
|
||||||
iso: false,
|
output_format: "".into(),
|
||||||
bars_on_right: false,
|
bars_on_right: false,
|
||||||
};
|
};
|
||||||
DisplayData {
|
DisplayData {
|
||||||
@@ -503,26 +537,43 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_human_readable_number() {
|
fn test_human_readable_number() {
|
||||||
assert_eq!(human_readable_number(1, false), "1B");
|
assert_eq!(human_readable_number(1, ""), "1B");
|
||||||
assert_eq!(human_readable_number(956, false), "956B");
|
assert_eq!(human_readable_number(956, ""), "956B");
|
||||||
assert_eq!(human_readable_number(1004, false), "1004B");
|
assert_eq!(human_readable_number(1004, ""), "1004B");
|
||||||
assert_eq!(human_readable_number(1024, false), "1.0K");
|
assert_eq!(human_readable_number(1024, ""), "1.0K");
|
||||||
assert_eq!(human_readable_number(1536, false), "1.5K");
|
assert_eq!(human_readable_number(1536, ""), "1.5K");
|
||||||
assert_eq!(human_readable_number(1024 * 512, false), "512K");
|
assert_eq!(human_readable_number(1024 * 512, ""), "512K");
|
||||||
assert_eq!(human_readable_number(1024 * 1024, false), "1.0M");
|
assert_eq!(human_readable_number(1024 * 1024, ""), "1.0M");
|
||||||
assert_eq!(
|
assert_eq!(human_readable_number(1024 * 1024 * 1024 - 1, ""), "1023M");
|
||||||
human_readable_number(1024 * 1024 * 1024 - 1, false),
|
assert_eq!(human_readable_number(1024 * 1024 * 1024 * 20, ""), "20G");
|
||||||
"1023M"
|
assert_eq!(human_readable_number(1024 * 1024 * 1024 * 1024, ""), "1.0T");
|
||||||
);
|
}
|
||||||
assert_eq!(human_readable_number(1024 * 1024 * 1024 * 20, false), "20G");
|
|
||||||
assert_eq!(
|
#[test]
|
||||||
human_readable_number(1024 * 1024 * 1024 * 1024, false),
|
fn test_human_readable_number_si() {
|
||||||
"1.0T"
|
assert_eq!(human_readable_number(1024 * 100, ""), "100K");
|
||||||
);
|
assert_eq!(human_readable_number(1024 * 100, "si"), "102K");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refer to https://en.wikipedia.org/wiki/Byte#Multiple-byte_units
|
||||||
|
#[test]
|
||||||
|
fn test_human_readable_number_kb() {
|
||||||
|
let hrn = human_readable_number;
|
||||||
|
assert_eq!(hrn(1023, "b"), "1023B");
|
||||||
|
assert_eq!(hrn(1000 * 1000, "bytes"), "1000000B");
|
||||||
|
assert_eq!(hrn(1023, "kb"), "1K");
|
||||||
|
assert_eq!(hrn(1023, "k"), "0K");
|
||||||
|
assert_eq!(hrn(1023, "kib"), "0K");
|
||||||
|
assert_eq!(hrn(1024, "kib"), "1K");
|
||||||
|
assert_eq!(hrn(1024 * 512, "kib"), "512K");
|
||||||
|
assert_eq!(hrn(1024 * 1024, "kib"), "1024K");
|
||||||
|
assert_eq!(hrn(1024 * 1000 * 1000 * 20, "kib"), "20000000K");
|
||||||
|
assert_eq!(hrn(1024 * 1024 * 1000 * 20, "mib"), "20000M");
|
||||||
|
assert_eq!(hrn(1024 * 1024 * 1024 * 20, "gib"), "20G");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn build_draw_data<'a>(disp: &'a DisplayData, size: u32) -> (DrawData<'a>, DisplayNode) {
|
fn build_draw_data(disp: &DisplayData, size: u32) -> (DrawData<'_>, DisplayNode) {
|
||||||
let n = DisplayNode {
|
let n = DisplayNode {
|
||||||
name: PathBuf::from("/short"),
|
name: PathBuf::from("/short"),
|
||||||
size: 2_u64.pow(size),
|
size: 2_u64.pow(size),
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,8 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
|
use serde::Serialize;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Serialize)]
|
||||||
pub struct DisplayNode {
|
pub struct DisplayNode {
|
||||||
// Note: the order of fields in important here, for PartialEq and PartialOrd
|
// Note: the order of fields in important here, for PartialEq and PartialOrd
|
||||||
pub size: u64,
|
pub size: u64,
|
||||||
|
|||||||
+121
-59
@@ -19,6 +19,7 @@ use filter::AggregateData;
|
|||||||
use progress::PIndicator;
|
use progress::PIndicator;
|
||||||
use regex::Error;
|
use regex::Error;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
use std::env;
|
||||||
use std::fs::read_to_string;
|
use std::fs::read_to_string;
|
||||||
use std::panic;
|
use std::panic;
|
||||||
use std::process;
|
use std::process;
|
||||||
@@ -41,29 +42,38 @@ use utils::simplify_dir_names;
|
|||||||
static DEFAULT_NUMBER_OF_LINES: usize = 30;
|
static DEFAULT_NUMBER_OF_LINES: usize = 30;
|
||||||
static DEFAULT_TERMINAL_WIDTH: usize = 80;
|
static DEFAULT_TERMINAL_WIDTH: usize = 80;
|
||||||
|
|
||||||
fn init_color(no_color: bool) -> bool {
|
fn should_init_color(no_color: bool, force_color: bool) -> bool {
|
||||||
|
if force_color {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if no_color {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// check if NO_COLOR is set
|
||||||
|
// https://no-color.org/
|
||||||
|
if env::var_os("NO_COLOR").is_some() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if terminal_size().is_none() {
|
||||||
|
// we are not in a terminal, color may not be needed
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// we are in a terminal
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
// If no color is already set do not print a warning message
|
// Required for windows 10
|
||||||
if no_color {
|
// Fails to resolve for windows 8 so disable color
|
||||||
true
|
match ansi_term::enable_ansi_support() {
|
||||||
} else {
|
Ok(_) => true,
|
||||||
// Required for windows 10
|
Err(_) => {
|
||||||
// Fails to resolve for windows 8 so disable color
|
eprintln!("This version of Windows does not support ANSI colors");
|
||||||
match ansi_term::enable_ansi_support() {
|
false
|
||||||
Ok(_) => no_color,
|
|
||||||
Err(_) => {
|
|
||||||
eprintln!(
|
|
||||||
"This version of Windows does not support ANSI colors, setting no_color flag"
|
|
||||||
);
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
{
|
{
|
||||||
no_color
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,6 +115,17 @@ fn main() {
|
|||||||
let options = build_cli().get_matches();
|
let options = build_cli().get_matches();
|
||||||
let config = get_config();
|
let config = get_config();
|
||||||
|
|
||||||
|
let errors = RuntimeErrors::default();
|
||||||
|
let error_listen_for_ctrlc = Arc::new(Mutex::new(errors));
|
||||||
|
let errors_for_rayon = error_listen_for_ctrlc.clone();
|
||||||
|
let errors_final = error_listen_for_ctrlc.clone();
|
||||||
|
|
||||||
|
ctrlc::set_handler(move || {
|
||||||
|
error_listen_for_ctrlc.lock().unwrap().abort = true;
|
||||||
|
println!("\nAborting");
|
||||||
|
})
|
||||||
|
.expect("Error setting Ctrl-C handler");
|
||||||
|
|
||||||
let target_dirs = match options.get_many::<String>("params") {
|
let target_dirs = match options.get_many::<String>("params") {
|
||||||
Some(values) => values.map(|v| v.as_str()).collect::<Vec<&str>>(),
|
Some(values) => values.map(|v| v.as_str()).collect::<Vec<&str>>(),
|
||||||
None => vec!["."],
|
None => vec!["."],
|
||||||
@@ -136,7 +157,10 @@ fn main() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let no_colors = init_color(config.get_no_colors(&options));
|
let is_colors = should_init_color(
|
||||||
|
config.get_no_colors(&options),
|
||||||
|
config.get_force_colors(&options),
|
||||||
|
);
|
||||||
|
|
||||||
let ignore_directories = match options.get_many::<String>("ignore_directory") {
|
let ignore_directories = match options.get_many::<String>("ignore_directory") {
|
||||||
Some(values) => values
|
Some(values) => values
|
||||||
@@ -168,39 +192,47 @@ fn main() {
|
|||||||
let limit_filesystem = options.get_flag("limit_filesystem");
|
let limit_filesystem = options.get_flag("limit_filesystem");
|
||||||
let follow_links = options.get_flag("dereference_links");
|
let follow_links = options.get_flag("dereference_links");
|
||||||
|
|
||||||
let simplified_dirs = simplify_dir_names(target_dirs);
|
|
||||||
let allowed_filesystems = limit_filesystem
|
let allowed_filesystems = limit_filesystem
|
||||||
.then(|| get_filesystem_devices(simplified_dirs.iter()))
|
.then(|| get_filesystem_devices(&target_dirs))
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
let simplified_dirs = simplify_dir_names(&target_dirs);
|
||||||
|
|
||||||
let ignored_full_path: HashSet<PathBuf> = ignore_directories
|
let ignored_full_path: HashSet<PathBuf> = ignore_directories
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(|x| simplified_dirs.iter().map(move |d| d.join(&x)))
|
.flat_map(|x| simplified_dirs.iter().map(move |d| d.join(&x)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let iso = config.get_iso(&options);
|
let output_format = config.get_output_format(&options);
|
||||||
|
|
||||||
let ignore_hidden = config.get_ignore_hidden(&options);
|
let ignore_hidden = config.get_ignore_hidden(&options);
|
||||||
|
|
||||||
let mut indicator = PIndicator::build_me();
|
let mut indicator = PIndicator::build_me();
|
||||||
if !config.get_disable_progress(&options) {
|
if !config.get_disable_progress(&options) {
|
||||||
indicator.spawn(iso);
|
indicator.spawn(output_format.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let filter_modified_time = config.get_modified_time_operator(&options);
|
||||||
|
let filter_accessed_time = config.get_accessed_time_operator(&options);
|
||||||
|
let filter_changed_time = config.get_created_time_operator(&options);
|
||||||
|
|
||||||
let walk_data = WalkData {
|
let walk_data = WalkData {
|
||||||
ignore_directories: ignored_full_path,
|
ignore_directories: ignored_full_path,
|
||||||
filter_regex: &filter_regexs,
|
filter_regex: &filter_regexs,
|
||||||
invert_filter_regex: &invert_filter_regexs,
|
invert_filter_regex: &invert_filter_regexs,
|
||||||
allowed_filesystems,
|
allowed_filesystems,
|
||||||
|
filter_modified_time,
|
||||||
|
filter_accessed_time,
|
||||||
|
filter_changed_time,
|
||||||
use_apparent_size: config.get_apparent_size(&options),
|
use_apparent_size: config.get_apparent_size(&options),
|
||||||
by_filecount,
|
by_filecount,
|
||||||
ignore_hidden,
|
ignore_hidden,
|
||||||
follow_links,
|
follow_links,
|
||||||
progress_data: indicator.data.clone(),
|
progress_data: indicator.data.clone(),
|
||||||
errors: Arc::new(Mutex::new(RuntimeErrors::default())),
|
errors: errors_for_rayon,
|
||||||
};
|
};
|
||||||
|
let threads_to_use = config.get_threads(&options);
|
||||||
let stack_size = config.get_custom_stack_size(&options);
|
let stack_size = config.get_custom_stack_size(&options);
|
||||||
init_rayon(&stack_size);
|
init_rayon(&stack_size, &threads_to_use);
|
||||||
|
|
||||||
let top_level_nodes = walk_it(simplified_dirs, &walk_data);
|
let top_level_nodes = walk_it(simplified_dirs, &walk_data);
|
||||||
|
|
||||||
@@ -208,7 +240,7 @@ fn main() {
|
|||||||
true => get_all_file_types(&top_level_nodes, number_of_lines),
|
true => get_all_file_types(&top_level_nodes, number_of_lines),
|
||||||
false => {
|
false => {
|
||||||
let agg_data = AggregateData {
|
let agg_data = AggregateData {
|
||||||
min_size: config.get_min_size(&options, iso),
|
min_size: config.get_min_size(&options),
|
||||||
only_dir: config.get_only_dir(&options),
|
only_dir: config.get_only_dir(&options),
|
||||||
only_file: config.get_only_file(&options),
|
only_file: config.get_only_file(&options),
|
||||||
number_of_lines,
|
number_of_lines,
|
||||||
@@ -222,8 +254,11 @@ fn main() {
|
|||||||
// Must have stopped indicator before we print to stderr
|
// Must have stopped indicator before we print to stderr
|
||||||
indicator.stop();
|
indicator.stop();
|
||||||
|
|
||||||
|
if errors_final.lock().unwrap().abort {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let final_errors = walk_data.errors.lock().unwrap();
|
let final_errors = walk_data.errors.lock().unwrap();
|
||||||
let failed_permissions = final_errors.no_permissions;
|
|
||||||
if !final_errors.file_not_found.is_empty() {
|
if !final_errors.file_not_found.is_empty() {
|
||||||
let err = final_errors
|
let err = final_errors
|
||||||
.file_not_found
|
.file_not_found
|
||||||
@@ -233,8 +268,20 @@ fn main() {
|
|||||||
.join(", ");
|
.join(", ");
|
||||||
eprintln!("No such file or directory: {}", err);
|
eprintln!("No such file or directory: {}", err);
|
||||||
}
|
}
|
||||||
if failed_permissions {
|
if !final_errors.no_permissions.is_empty() {
|
||||||
eprintln!("Did not have permissions for all directories");
|
if config.get_print_errors(&options) {
|
||||||
|
let err = final_errors
|
||||||
|
.no_permissions
|
||||||
|
.iter()
|
||||||
|
.map(|a| a.as_ref())
|
||||||
|
.collect::<Vec<&str>>()
|
||||||
|
.join(", ");
|
||||||
|
eprintln!("Did not have permissions for directories: {}", err);
|
||||||
|
} else {
|
||||||
|
eprintln!(
|
||||||
|
"Did not have permissions for all directories (add --print-errors to see errors)"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if !final_errors.unknown_error.is_empty() {
|
if !final_errors.unknown_error.is_empty() {
|
||||||
let err = final_errors
|
let err = final_errors
|
||||||
@@ -250,50 +297,65 @@ fn main() {
|
|||||||
let idd = InitialDisplayData {
|
let idd = InitialDisplayData {
|
||||||
short_paths: !config.get_full_paths(&options),
|
short_paths: !config.get_full_paths(&options),
|
||||||
is_reversed: !config.get_reverse(&options),
|
is_reversed: !config.get_reverse(&options),
|
||||||
colors_on: !no_colors,
|
colors_on: is_colors,
|
||||||
by_filecount,
|
by_filecount,
|
||||||
iso,
|
|
||||||
is_screen_reader: config.get_screen_reader(&options),
|
is_screen_reader: config.get_screen_reader(&options),
|
||||||
|
output_format,
|
||||||
bars_on_right: config.get_bars_on_right(&options),
|
bars_on_right: config.get_bars_on_right(&options),
|
||||||
};
|
};
|
||||||
draw_it(
|
|
||||||
idd,
|
if config.get_output_json(&options) {
|
||||||
config.get_no_bars(&options),
|
println!("{}", serde_json::to_string(&root_node).unwrap());
|
||||||
terminal_width,
|
} else {
|
||||||
&root_node,
|
draw_it(
|
||||||
config.get_skip_total(&options),
|
idd,
|
||||||
)
|
config.get_no_bars(&options),
|
||||||
|
terminal_width,
|
||||||
|
&root_node,
|
||||||
|
config.get_skip_total(&options),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_rayon(stack_size: &Option<usize>) {
|
fn init_rayon(stack_size: &Option<usize>, threads: &Option<usize>) {
|
||||||
// Rayon seems to raise this error on 32-bit builds
|
// Rayon seems to raise this error on 32-bit builds
|
||||||
// The global thread pool has not been initialized.: ThreadPoolBuildError { kind: GlobalPoolAlreadyInitialized }
|
// The global thread pool has not been initialized.: ThreadPoolBuildError { kind: GlobalPoolAlreadyInitialized }
|
||||||
if cfg!(target_pointer_width = "64") {
|
if cfg!(target_pointer_width = "64") {
|
||||||
let result = panic::catch_unwind(|| {
|
let result = panic::catch_unwind(|| build_thread_pool(*stack_size, *threads));
|
||||||
match stack_size {
|
|
||||||
Some(n) => rayon::ThreadPoolBuilder::new()
|
|
||||||
.stack_size(*n)
|
|
||||||
.build_global(),
|
|
||||||
None => {
|
|
||||||
let large_stack = usize::pow(1024, 3);
|
|
||||||
let mut s = System::new();
|
|
||||||
s.refresh_memory();
|
|
||||||
let available = s.available_memory();
|
|
||||||
|
|
||||||
if available > large_stack.try_into().unwrap() {
|
|
||||||
// Larger stack size to handle cases with lots of nested directories
|
|
||||||
rayon::ThreadPoolBuilder::new()
|
|
||||||
.stack_size(large_stack)
|
|
||||||
.build_global()
|
|
||||||
} else {
|
|
||||||
rayon::ThreadPoolBuilder::new().build_global()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
eprintln!("Problem initializing rayon, try: export RAYON_NUM_THREADS=1")
|
eprintln!("Problem initializing rayon, try: export RAYON_NUM_THREADS=1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn build_thread_pool(
|
||||||
|
stack: Option<usize>,
|
||||||
|
threads: Option<usize>,
|
||||||
|
) -> Result<(), rayon::ThreadPoolBuildError> {
|
||||||
|
let mut pool = rayon::ThreadPoolBuilder::new();
|
||||||
|
|
||||||
|
if let Some(thread_count) = threads {
|
||||||
|
pool = pool.num_threads(thread_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
let stack_size = match stack {
|
||||||
|
Some(s) => Some(s),
|
||||||
|
None => {
|
||||||
|
let large_stack = usize::pow(1024, 3);
|
||||||
|
let mut s = System::new();
|
||||||
|
s.refresh_memory();
|
||||||
|
// Larger stack size if possible to handle cases with lots of nested directories
|
||||||
|
let available = s.available_memory();
|
||||||
|
if available > large_stack.try_into().unwrap() {
|
||||||
|
Some(large_stack)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if let Some(stack_size_param) = stack_size {
|
||||||
|
pool = pool.stack_size(stack_size_param);
|
||||||
|
}
|
||||||
|
pool.build_global()
|
||||||
|
}
|
||||||
|
|||||||
+17
-8
@@ -1,8 +1,9 @@
|
|||||||
|
use crate::dir_walker::WalkData;
|
||||||
use crate::platform::get_metadata;
|
use crate::platform::get_metadata;
|
||||||
|
use crate::utils::is_filtered_out_due_to_file_time;
|
||||||
use crate::utils::is_filtered_out_due_to_invert_regex;
|
use crate::utils::is_filtered_out_due_to_invert_regex;
|
||||||
use crate::utils::is_filtered_out_due_to_regex;
|
use crate::utils::is_filtered_out_due_to_regex;
|
||||||
|
|
||||||
use regex::Regex;
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
@@ -19,14 +20,14 @@ pub struct Node {
|
|||||||
pub fn build_node(
|
pub fn build_node(
|
||||||
dir: PathBuf,
|
dir: PathBuf,
|
||||||
children: Vec<Node>,
|
children: Vec<Node>,
|
||||||
filter_regex: &[Regex],
|
|
||||||
invert_filter_regex: &[Regex],
|
|
||||||
use_apparent_size: bool,
|
|
||||||
is_symlink: bool,
|
is_symlink: bool,
|
||||||
is_file: bool,
|
is_file: bool,
|
||||||
by_filecount: bool,
|
|
||||||
depth: usize,
|
depth: usize,
|
||||||
|
walk_data: &WalkData,
|
||||||
) -> Option<Node> {
|
) -> Option<Node> {
|
||||||
|
let use_apparent_size = walk_data.use_apparent_size;
|
||||||
|
let by_filecount = walk_data.by_filecount;
|
||||||
|
|
||||||
get_metadata(&dir, use_apparent_size).map(|data| {
|
get_metadata(&dir, use_apparent_size).map(|data| {
|
||||||
let inode_device = if is_symlink && !use_apparent_size {
|
let inode_device = if is_symlink && !use_apparent_size {
|
||||||
None
|
None
|
||||||
@@ -34,11 +35,19 @@ pub fn build_node(
|
|||||||
data.1
|
data.1
|
||||||
};
|
};
|
||||||
|
|
||||||
let size = if is_filtered_out_due_to_regex(filter_regex, &dir)
|
let size = if is_filtered_out_due_to_regex(walk_data.filter_regex, &dir)
|
||||||
|| is_filtered_out_due_to_invert_regex(invert_filter_regex, &dir)
|
|| is_filtered_out_due_to_invert_regex(walk_data.invert_filter_regex, &dir)
|
||||||
|| (is_symlink && !use_apparent_size)
|
|| (is_symlink && !use_apparent_size)
|
||||||
|| by_filecount && !is_file
|
|| by_filecount && !is_file
|
||||||
{
|
|| [
|
||||||
|
(&walk_data.filter_modified_time, data.2 .0),
|
||||||
|
(&walk_data.filter_accessed_time, data.2 .1),
|
||||||
|
(&walk_data.filter_changed_time, data.2 .2),
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.any(|(filter_time, actual_time)| {
|
||||||
|
is_filtered_out_due_to_file_time(filter_time, *actual_time)
|
||||||
|
}) {
|
||||||
0
|
0
|
||||||
} else if by_filecount {
|
} else if by_filecount {
|
||||||
1
|
1
|
||||||
|
|||||||
+50
-14
@@ -10,15 +10,29 @@ fn get_block_size() -> u64 {
|
|||||||
512
|
512
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type InodeAndDevice = (u64, u64);
|
||||||
|
type FileTime = (i64, i64, i64);
|
||||||
|
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
pub fn get_metadata(d: &Path, use_apparent_size: bool) -> Option<(u64, Option<(u64, u64)>)> {
|
pub fn get_metadata<P: AsRef<Path>>(
|
||||||
|
path: P,
|
||||||
|
use_apparent_size: bool,
|
||||||
|
) -> Option<(u64, Option<InodeAndDevice>, FileTime)> {
|
||||||
use std::os::unix::fs::MetadataExt;
|
use std::os::unix::fs::MetadataExt;
|
||||||
match d.metadata() {
|
match path.as_ref().metadata() {
|
||||||
Ok(md) => {
|
Ok(md) => {
|
||||||
if use_apparent_size {
|
if use_apparent_size {
|
||||||
Some((md.len(), Some((md.ino(), md.dev()))))
|
Some((
|
||||||
|
md.len(),
|
||||||
|
Some((md.ino(), md.dev())),
|
||||||
|
(md.mtime(), md.atime(), md.ctime()),
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
Some((md.blocks() * get_block_size(), Some((md.ino(), md.dev()))))
|
Some((
|
||||||
|
md.blocks() * get_block_size(),
|
||||||
|
Some((md.ino(), md.dev())),
|
||||||
|
(md.mtime(), md.atime(), md.ctime()),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_e) => None,
|
Err(_e) => None,
|
||||||
@@ -26,7 +40,10 @@ pub fn get_metadata(d: &Path, use_apparent_size: bool) -> Option<(u64, Option<(u
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_family = "windows")]
|
#[cfg(target_family = "windows")]
|
||||||
pub fn get_metadata(d: &Path, use_apparent_size: bool) -> Option<(u64, Option<(u64, u64)>)> {
|
pub fn get_metadata<P: AsRef<Path>>(
|
||||||
|
path: P,
|
||||||
|
use_apparent_size: bool,
|
||||||
|
) -> Option<(u64, Option<InodeAndDevice>, FileTime)> {
|
||||||
// On windows opening the file to get size, file ID and volume can be very
|
// On windows opening the file to get size, file ID and volume can be very
|
||||||
// expensive because 1) it causes a few system calls, and more importantly 2) it can cause
|
// expensive because 1) it causes a few system calls, and more importantly 2) it can cause
|
||||||
// windows defender to scan the file.
|
// windows defender to scan the file.
|
||||||
@@ -65,7 +82,7 @@ pub fn get_metadata(d: &Path, use_apparent_size: bool) -> Option<(u64, Option<(u
|
|||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use winapi_util::Handle;
|
use winapi_util::Handle;
|
||||||
fn handle_from_path_limited<P: AsRef<Path>>(path: P) -> io::Result<Handle> {
|
fn handle_from_path_limited(path: &Path) -> io::Result<Handle> {
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::os::windows::fs::OpenOptionsExt;
|
use std::os::windows::fs::OpenOptionsExt;
|
||||||
const FILE_READ_ATTRIBUTES: u32 = 0x0080;
|
const FILE_READ_ATTRIBUTES: u32 = 0x0080;
|
||||||
@@ -91,30 +108,41 @@ pub fn get_metadata(d: &Path, use_apparent_size: bool) -> Option<(u64, Option<(u
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_metadata_expensive(
|
fn get_metadata_expensive(
|
||||||
d: &Path,
|
path: &Path,
|
||||||
use_apparent_size: bool,
|
use_apparent_size: bool,
|
||||||
) -> Option<(u64, Option<(u64, u64)>)> {
|
) -> Option<(u64, Option<InodeAndDevice>, FileTime)> {
|
||||||
use winapi_util::file::information;
|
use winapi_util::file::information;
|
||||||
|
|
||||||
let h = handle_from_path_limited(d).ok()?;
|
let h = handle_from_path_limited(path).ok()?;
|
||||||
let info = information(&h).ok()?;
|
let info = information(&h).ok()?;
|
||||||
|
|
||||||
if use_apparent_size {
|
if use_apparent_size {
|
||||||
use filesize::PathExt;
|
use filesize::PathExt;
|
||||||
Some((
|
Some((
|
||||||
d.size_on_disk().ok()?,
|
path.size_on_disk().ok()?,
|
||||||
Some((info.file_index(), info.volume_serial_number())),
|
Some((info.file_index(), info.volume_serial_number())),
|
||||||
|
(
|
||||||
|
info.last_write_time().unwrap() as i64,
|
||||||
|
info.last_access_time().unwrap() as i64,
|
||||||
|
info.creation_time().unwrap() as i64,
|
||||||
|
),
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
Some((
|
Some((
|
||||||
info.file_size(),
|
info.file_size(),
|
||||||
Some((info.file_index(), info.volume_serial_number())),
|
Some((info.file_index(), info.volume_serial_number())),
|
||||||
|
(
|
||||||
|
info.last_write_time().unwrap() as i64,
|
||||||
|
info.last_access_time().unwrap() as i64,
|
||||||
|
info.creation_time().unwrap() as i64,
|
||||||
|
),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::os::windows::fs::MetadataExt;
|
use std::os::windows::fs::MetadataExt;
|
||||||
match d.metadata() {
|
let path = path.as_ref();
|
||||||
|
match path.metadata() {
|
||||||
Ok(ref md) => {
|
Ok(ref md) => {
|
||||||
const FILE_ATTRIBUTE_ARCHIVE: u32 = 0x20;
|
const FILE_ATTRIBUTE_ARCHIVE: u32 = 0x20;
|
||||||
const FILE_ATTRIBUTE_READONLY: u32 = 0x01;
|
const FILE_ATTRIBUTE_READONLY: u32 = 0x01;
|
||||||
@@ -142,11 +170,19 @@ pub fn get_metadata(d: &Path, use_apparent_size: bool) -> Option<(u64, Option<(u
|
|||||||
|| md.file_attributes() == FILE_ATTRIBUTE_NORMAL)
|
|| md.file_attributes() == FILE_ATTRIBUTE_NORMAL)
|
||||||
&& !((attr_filtered & IS_PROBABLY_ONEDRIVE != 0) && use_apparent_size)
|
&& !((attr_filtered & IS_PROBABLY_ONEDRIVE != 0) && use_apparent_size)
|
||||||
{
|
{
|
||||||
Some((md.len(), None))
|
Some((
|
||||||
|
md.len(),
|
||||||
|
None,
|
||||||
|
(
|
||||||
|
md.last_write_time() as i64,
|
||||||
|
md.last_access_time() as i64,
|
||||||
|
md.creation_time() as i64,
|
||||||
|
),
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
get_metadata_expensive(d, use_apparent_size)
|
get_metadata_expensive(path, use_apparent_size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => get_metadata_expensive(d, use_apparent_size),
|
_ => get_metadata_expensive(path, use_apparent_size),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-8
@@ -70,23 +70,24 @@ impl PAtomicInfo {
|
|||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct RuntimeErrors {
|
pub struct RuntimeErrors {
|
||||||
pub no_permissions: bool,
|
pub no_permissions: HashSet<String>,
|
||||||
pub file_not_found: HashSet<String>,
|
pub file_not_found: HashSet<String>,
|
||||||
pub unknown_error: HashSet<String>,
|
pub unknown_error: HashSet<String>,
|
||||||
|
pub abort: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
fn format_preparing_str(prog_char: char, data: &PAtomicInfo, is_iso: bool) -> String {
|
fn format_preparing_str(prog_char: char, data: &PAtomicInfo, output_display: &str) -> String {
|
||||||
let path_in = data.current_path.get();
|
let path_in = data.current_path.get();
|
||||||
let size = human_readable_number(data.total_file_size.load(ORDERING), is_iso);
|
let size = human_readable_number(data.total_file_size.load(ORDERING), output_display);
|
||||||
format!("Preparing: {path_in} {size} ... {prog_char}")
|
format!("Preparing: {path_in} {size} ... {prog_char}")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_indexing_str(prog_char: char, data: &PAtomicInfo, is_iso: bool) -> String {
|
fn format_indexing_str(prog_char: char, data: &PAtomicInfo, output_display: &str) -> String {
|
||||||
let path_in = data.current_path.get();
|
let path_in = data.current_path.get();
|
||||||
let file_count = data.num_files.load(ORDERING);
|
let file_count = data.num_files.load(ORDERING);
|
||||||
let size = human_readable_number(data.total_file_size.load(ORDERING), is_iso);
|
let size = human_readable_number(data.total_file_size.load(ORDERING), output_display);
|
||||||
let file_str = format!("{file_count} files, {size}");
|
let file_str = format!("{file_count} files, {size}");
|
||||||
format!("Indexing: {path_in} {file_str} ... {prog_char}")
|
format!("Indexing: {path_in} {file_str} ... {prog_char}")
|
||||||
}
|
}
|
||||||
@@ -106,7 +107,7 @@ impl PIndicator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn(&mut self, is_iso: bool) {
|
pub fn spawn(&mut self, output_display: String) {
|
||||||
let data = self.data.clone();
|
let data = self.data.clone();
|
||||||
let (stop_handler, receiver) = mpsc::channel::<()>();
|
let (stop_handler, receiver) = mpsc::channel::<()>();
|
||||||
|
|
||||||
@@ -125,8 +126,8 @@ impl PIndicator {
|
|||||||
let prog_char = PROGRESS_CHARS[progress_char_i];
|
let prog_char = PROGRESS_CHARS[progress_char_i];
|
||||||
|
|
||||||
msg = match data.state.load(ORDERING) {
|
msg = match data.state.load(ORDERING) {
|
||||||
Operation::INDEXING => format_indexing_str(prog_char, &data, is_iso),
|
Operation::INDEXING => format_indexing_str(prog_char, &data, &output_display),
|
||||||
Operation::PREPARING => format_preparing_str(prog_char, &data, is_iso),
|
Operation::PREPARING => format_preparing_str(prog_char, &data, &output_display),
|
||||||
_ => panic!("Unknown State"),
|
_ => panic!("Unknown State"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+26
-13
@@ -2,13 +2,16 @@ use platform::get_metadata;
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use crate::config::DAY_SECONDS;
|
||||||
|
|
||||||
|
use crate::dir_walker::Operater;
|
||||||
use crate::platform;
|
use crate::platform;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
pub fn simplify_dir_names<P: AsRef<Path>>(filenames: Vec<P>) -> HashSet<PathBuf> {
|
pub fn simplify_dir_names<P: AsRef<Path>>(dirs: &[P]) -> HashSet<PathBuf> {
|
||||||
let mut top_level_names: HashSet<PathBuf> = HashSet::with_capacity(filenames.len());
|
let mut top_level_names: HashSet<PathBuf> = HashSet::with_capacity(dirs.len());
|
||||||
|
|
||||||
for t in filenames {
|
for t in dirs {
|
||||||
let top_level_name = normalize_path(t);
|
let top_level_name = normalize_path(t);
|
||||||
let mut can_add = true;
|
let mut can_add = true;
|
||||||
let mut to_remove: Vec<PathBuf> = Vec::new();
|
let mut to_remove: Vec<PathBuf> = Vec::new();
|
||||||
@@ -31,12 +34,12 @@ pub fn simplify_dir_names<P: AsRef<Path>>(filenames: Vec<P>) -> HashSet<PathBuf>
|
|||||||
top_level_names
|
top_level_names
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_filesystem_devices<'a, P: IntoIterator<Item = &'a PathBuf>>(paths: P) -> HashSet<u64> {
|
pub fn get_filesystem_devices<P: AsRef<Path>>(paths: &[P]) -> HashSet<u64> {
|
||||||
// Gets the device ids for the filesystems which are used by the argument paths
|
// Gets the device ids for the filesystems which are used by the argument paths
|
||||||
paths
|
paths
|
||||||
.into_iter()
|
.iter()
|
||||||
.filter_map(|p| match get_metadata(p, false) {
|
.filter_map(|p| match get_metadata(p, false) {
|
||||||
Some((_size, Some((_id, dev)))) => Some(dev),
|
Some((_size, Some((_id, dev)), _time)) => Some(dev),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
@@ -62,6 +65,16 @@ pub fn is_filtered_out_due_to_regex(filter_regex: &[Regex], dir: &Path) -> bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_filtered_out_due_to_file_time(filter_time: &(Operater, i64), actual_time: i64) -> bool {
|
||||||
|
match filter_time {
|
||||||
|
(Operater::Equal, bound_time) => {
|
||||||
|
!(actual_time >= *bound_time && actual_time < *bound_time + DAY_SECONDS)
|
||||||
|
}
|
||||||
|
(Operater::GreaterThan, bound_time) => actual_time < *bound_time,
|
||||||
|
(Operater::LessThan, bound_time) => actual_time > *bound_time,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_filtered_out_due_to_invert_regex(filter_regex: &[Regex], dir: &Path) -> bool {
|
pub fn is_filtered_out_due_to_invert_regex(filter_regex: &[Regex], dir: &Path) -> bool {
|
||||||
filter_regex
|
filter_regex
|
||||||
.iter()
|
.iter()
|
||||||
@@ -82,15 +95,15 @@ mod tests {
|
|||||||
fn test_simplify_dir() {
|
fn test_simplify_dir() {
|
||||||
let mut correct = HashSet::new();
|
let mut correct = HashSet::new();
|
||||||
correct.insert(PathBuf::from("a"));
|
correct.insert(PathBuf::from("a"));
|
||||||
assert_eq!(simplify_dir_names(vec!["a"]), correct);
|
assert_eq!(simplify_dir_names(&["a"]), correct);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simplify_dir_rm_subdir() {
|
fn test_simplify_dir_rm_subdir() {
|
||||||
let mut correct = HashSet::new();
|
let mut correct = HashSet::new();
|
||||||
correct.insert(["a", "b"].iter().collect::<PathBuf>());
|
correct.insert(["a", "b"].iter().collect::<PathBuf>());
|
||||||
assert_eq!(simplify_dir_names(vec!["a/b/c", "a/b", "a/b/d/f"]), correct);
|
assert_eq!(simplify_dir_names(&["a/b/c", "a/b", "a/b/d/f"]), correct);
|
||||||
assert_eq!(simplify_dir_names(vec!["a/b", "a/b/c", "a/b/d/f"]), correct);
|
assert_eq!(simplify_dir_names(&["a/b", "a/b/c", "a/b/d/f"]), correct);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -99,7 +112,7 @@ mod tests {
|
|||||||
correct.insert(["a", "b"].iter().collect::<PathBuf>());
|
correct.insert(["a", "b"].iter().collect::<PathBuf>());
|
||||||
correct.insert(PathBuf::from("c"));
|
correct.insert(PathBuf::from("c"));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
simplify_dir_names(vec![
|
simplify_dir_names(&[
|
||||||
"a/b",
|
"a/b",
|
||||||
"a/b//",
|
"a/b//",
|
||||||
"a/././b///",
|
"a/././b///",
|
||||||
@@ -118,14 +131,14 @@ mod tests {
|
|||||||
correct.insert(PathBuf::from("b"));
|
correct.insert(PathBuf::from("b"));
|
||||||
correct.insert(["c", "a", "b"].iter().collect::<PathBuf>());
|
correct.insert(["c", "a", "b"].iter().collect::<PathBuf>());
|
||||||
correct.insert(["a", "b"].iter().collect::<PathBuf>());
|
correct.insert(["a", "b"].iter().collect::<PathBuf>());
|
||||||
assert_eq!(simplify_dir_names(vec!["a/b", "c/a/b/", "b"]), correct);
|
assert_eq!(simplify_dir_names(&["a/b", "c/a/b/", "b"]), correct);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simplify_dir_dots() {
|
fn test_simplify_dir_dots() {
|
||||||
let mut correct = HashSet::new();
|
let mut correct = HashSet::new();
|
||||||
correct.insert(PathBuf::from("src"));
|
correct.insert(PathBuf::from("src"));
|
||||||
assert_eq!(simplify_dir_names(vec!["src/."]), correct);
|
assert_eq!(simplify_dir_names(&["src/."]), correct);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -133,7 +146,7 @@ mod tests {
|
|||||||
let mut correct = HashSet::new();
|
let mut correct = HashSet::new();
|
||||||
correct.insert(PathBuf::from("src"));
|
correct.insert(PathBuf::from("src"));
|
||||||
correct.insert(PathBuf::from("src_v2"));
|
correct.insert(PathBuf::from("src_v2"));
|
||||||
assert_eq!(simplify_dir_names(vec!["src/", "src_v2"]), correct);
|
assert_eq!(simplify_dir_names(&["src/", "src_v2"]), correct);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+72
-23
@@ -1,9 +1,11 @@
|
|||||||
use assert_cmd::Command;
|
use assert_cmd::Command;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::str;
|
use std::process::Output;
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
|
use std::{fs, io, str};
|
||||||
|
|
||||||
static INIT: Once = Once::new();
|
static INIT: Once = Once::new();
|
||||||
|
static UNREADABLE_DIR_PATH: &str = "/tmp/unreadable_dir";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file contains tests that verify the exact output of the command.
|
* This file contains tests that verify the exact output of the command.
|
||||||
@@ -33,34 +35,58 @@ fn copy_test_data(dir: &str) {
|
|||||||
.map_err(|err| eprintln!("Error copying directory for test setup\n{:?}", err));
|
.map_err(|err| eprintln!("Error copying directory for test setup\n{:?}", err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn create_unreadable_directory() -> io::Result<()> {
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
use std::fs::Permissions;
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
fs::create_dir_all(UNREADABLE_DIR_PATH)?;
|
||||||
|
fs::set_permissions(UNREADABLE_DIR_PATH, Permissions::from_mode(0))?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn initialize() {
|
fn initialize() {
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
copy_test_data("tests/test_dir");
|
copy_test_data("tests/test_dir");
|
||||||
copy_test_data("tests/test_dir2");
|
copy_test_data("tests/test_dir2");
|
||||||
copy_test_data("tests/test_dir_unicode");
|
copy_test_data("tests/test_dir_unicode");
|
||||||
|
|
||||||
|
if let Err(e) = create_unreadable_directory() {
|
||||||
|
panic!("Failed to create unreadable directory: {}", e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exact_output_test<T: AsRef<OsStr>>(valid_outputs: Vec<String>, command_args: Vec<T>) {
|
fn run_cmd<T: AsRef<OsStr>>(command_args: &[T]) -> Output {
|
||||||
initialize();
|
initialize();
|
||||||
|
let mut to_run = &mut Command::cargo_bin("dust").unwrap();
|
||||||
let mut a = &mut Command::cargo_bin("dust").unwrap();
|
|
||||||
|
|
||||||
for p in command_args {
|
for p in command_args {
|
||||||
a = a.arg(p);
|
to_run = to_run.arg(p);
|
||||||
}
|
}
|
||||||
|
to_run.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
let output = str::from_utf8(&a.unwrap().stdout).unwrap().to_owned();
|
fn exact_stdout_test<T: AsRef<OsStr>>(command_args: &[T], valid_stdout: Vec<String>) {
|
||||||
|
let to_run = run_cmd(command_args);
|
||||||
|
|
||||||
let will_fail = valid_outputs.iter().any(|i| output.contains(i));
|
let stdout_output = str::from_utf8(&to_run.stdout).unwrap().to_owned();
|
||||||
|
let will_fail = valid_stdout.iter().any(|i| stdout_output.contains(i));
|
||||||
if !will_fail {
|
if !will_fail {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"output:\n{}\ndoes not contain any of:\n{}",
|
"output(stdout):\n{}\ndoes not contain any of:\n{}",
|
||||||
output,
|
stdout_output,
|
||||||
valid_outputs.join("\n\n")
|
valid_stdout.join("\n\n")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
assert!(will_fail)
|
assert!(will_fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exact_stderr_test<T: AsRef<OsStr>>(command_args: &[T], valid_stderr: String) {
|
||||||
|
let to_run = run_cmd(command_args);
|
||||||
|
|
||||||
|
let stderr_output = str::from_utf8(&to_run.stderr).unwrap().trim();
|
||||||
|
assert_eq!(stderr_output, valid_stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "windows" result data can vary by host (size seems to be variable by one byte); fix code vs test and re-enable
|
// "windows" result data can vary by host (size seems to be variable by one byte); fix code vs test and re-enable
|
||||||
@@ -68,20 +94,20 @@ fn exact_output_test<T: AsRef<OsStr>>(valid_outputs: Vec<String>, command_args:
|
|||||||
#[test]
|
#[test]
|
||||||
pub fn test_main_basic() {
|
pub fn test_main_basic() {
|
||||||
// -c is no color mode - This makes testing much simpler
|
// -c is no color mode - This makes testing much simpler
|
||||||
exact_output_test(main_output(), vec!["-c", "-B", "/tmp/test_dir/"])
|
exact_stdout_test(&["-c", "-B", "/tmp/test_dir/"], main_output());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(target_os = "windows", ignore)]
|
#[cfg_attr(target_os = "windows", ignore)]
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_main_multi_arg() {
|
pub fn test_main_multi_arg() {
|
||||||
let command_args = vec![
|
let command_args = [
|
||||||
"-c",
|
"-c",
|
||||||
"-B",
|
"-B",
|
||||||
"/tmp/test_dir/many/",
|
"/tmp/test_dir/many/",
|
||||||
"/tmp/test_dir",
|
"/tmp/test_dir",
|
||||||
"/tmp/test_dir",
|
"/tmp/test_dir",
|
||||||
];
|
];
|
||||||
exact_output_test(main_output(), command_args);
|
exact_stdout_test(&command_args, main_output());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main_output() -> Vec<String> {
|
fn main_output() -> Vec<String> {
|
||||||
@@ -111,8 +137,8 @@ fn main_output() -> Vec<String> {
|
|||||||
#[cfg_attr(target_os = "windows", ignore)]
|
#[cfg_attr(target_os = "windows", ignore)]
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_main_long_paths() {
|
pub fn test_main_long_paths() {
|
||||||
let command_args = vec!["-c", "-p", "-B", "/tmp/test_dir/"];
|
let command_args = ["-c", "-p", "-B", "/tmp/test_dir/"];
|
||||||
exact_output_test(main_output_long_paths(), command_args);
|
exact_stdout_test(&command_args, main_output_long_paths());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main_output_long_paths() -> Vec<String> {
|
fn main_output_long_paths() -> Vec<String> {
|
||||||
@@ -139,8 +165,8 @@ fn main_output_long_paths() -> Vec<String> {
|
|||||||
#[cfg_attr(target_os = "windows", ignore)]
|
#[cfg_attr(target_os = "windows", ignore)]
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_substring_of_names_and_long_names() {
|
pub fn test_substring_of_names_and_long_names() {
|
||||||
let command_args = vec!["-c", "-B", "/tmp/test_dir2"];
|
let command_args = ["-c", "-B", "/tmp/test_dir2"];
|
||||||
exact_output_test(no_substring_of_names_output(), command_args);
|
exact_stdout_test(&command_args, no_substring_of_names_output());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn no_substring_of_names_output() -> Vec<String> {
|
fn no_substring_of_names_output() -> Vec<String> {
|
||||||
@@ -173,8 +199,8 @@ fn no_substring_of_names_output() -> Vec<String> {
|
|||||||
#[cfg_attr(target_os = "windows", ignore)]
|
#[cfg_attr(target_os = "windows", ignore)]
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_unicode_directories() {
|
pub fn test_unicode_directories() {
|
||||||
let command_args = vec!["-c", "-B", "/tmp/test_dir_unicode"];
|
let command_args = ["-c", "-B", "/tmp/test_dir_unicode"];
|
||||||
exact_output_test(unicode_dir(), command_args);
|
exact_stdout_test(&command_args, unicode_dir());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unicode_dir() -> Vec<String> {
|
fn unicode_dir() -> Vec<String> {
|
||||||
@@ -200,8 +226,8 @@ fn unicode_dir() -> Vec<String> {
|
|||||||
#[cfg_attr(target_os = "windows", ignore)]
|
#[cfg_attr(target_os = "windows", ignore)]
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_apparent_size() {
|
pub fn test_apparent_size() {
|
||||||
let command_args = vec!["-c", "-s", "-b", "/tmp/test_dir"];
|
let command_args = ["-c", "-s", "-b", "/tmp/test_dir"];
|
||||||
exact_output_test(apparent_size_output(), command_args);
|
exact_stdout_test(&command_args, apparent_size_output());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apparent_size_output() -> Vec<String> {
|
fn apparent_size_output() -> Vec<String> {
|
||||||
@@ -222,3 +248,26 @@ fn apparent_size_output() -> Vec<String> {
|
|||||||
|
|
||||||
vec![one_space_before, two_space_before]
|
vec![one_space_before, two_space_before]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(target_os = "windows", ignore)]
|
||||||
|
#[test]
|
||||||
|
pub fn test_permission_normal() {
|
||||||
|
let command_args = [UNREADABLE_DIR_PATH];
|
||||||
|
let permission_msg =
|
||||||
|
r#"Did not have permissions for all directories (add --print-errors to see errors)"#
|
||||||
|
.trim()
|
||||||
|
.to_string();
|
||||||
|
exact_stderr_test(&command_args, permission_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(target_os = "windows", ignore)]
|
||||||
|
#[test]
|
||||||
|
pub fn test_permission_flag() {
|
||||||
|
// add the flag to CLI
|
||||||
|
let command_args = ["--print-errors", UNREADABLE_DIR_PATH];
|
||||||
|
let permission_msg = format!(
|
||||||
|
"Did not have permissions for directories: {}",
|
||||||
|
UNREADABLE_DIR_PATH
|
||||||
|
);
|
||||||
|
exact_stderr_test(&command_args, permission_msg);
|
||||||
|
}
|
||||||
|
|||||||
+25
-3
@@ -59,6 +59,12 @@ pub fn test_d_flag_works() {
|
|||||||
assert!(!output.contains("hello_file"));
|
assert!(!output.contains("hello_file"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
pub fn test_threads_flag_works() {
|
||||||
|
let output = build_command(vec!["-T", "1", "tests/test_dir/"]);
|
||||||
|
assert!(output.contains("hello_file"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_d_flag_works_and_still_recurses_down() {
|
pub fn test_d_flag_works_and_still_recurses_down() {
|
||||||
// We had a bug where running with '-d 1' would stop at the first directory and the code
|
// We had a bug where running with '-d 1' would stop at the first directory and the code
|
||||||
@@ -133,9 +139,9 @@ pub fn test_show_files_by_type() {
|
|||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
pub fn test_show_files_only() {
|
pub fn test_show_files_only() {
|
||||||
let output = build_command(vec!["-c", "-F", "tests/test_dir"]);
|
let output = build_command(vec!["-c", "-F", "tests/test_dir"]);
|
||||||
assert!(output.contains("tests/test_dir/many/a_file"));
|
assert!(output.contains("a_file"));
|
||||||
assert!(output.contains("tests/test_dir/many/hello_file"));
|
assert!(output.contains("hello_file"));
|
||||||
assert!(!output.contains("tests/test_dir/many "));
|
assert!(!output.contains("many"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -232,3 +238,19 @@ pub fn test_show_files_by_invert_regex_match_multiple() {
|
|||||||
assert!(!output.contains("test_dir_unicode"));
|
assert!(!output.contains("test_dir_unicode"));
|
||||||
assert!(output.contains("many"));
|
assert!(output.contains("many"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
pub fn test_no_color() {
|
||||||
|
let output = build_command(vec!["-c"]);
|
||||||
|
// Red is 31
|
||||||
|
assert!(!output.contains("\x1B[31m"));
|
||||||
|
assert!(!output.contains("\x1B[0m"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
pub fn test_force_color() {
|
||||||
|
let output = build_command(vec!["-C"]);
|
||||||
|
// Red is 31
|
||||||
|
assert!(output.contains("\x1B[31m"));
|
||||||
|
assert!(output.contains("\x1B[0m"));
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user