Compare commits

...

15 Commits

Author SHA1 Message Date
andy.boot 36fd75b9ee Update packages 2021-01-16 15:12:52 +00:00
andy.boot 51a0ccb1ed Increment version 2021-01-16 15:05:33 +00:00
andy.boot 68b0dd5562 [core] New flag: width
Add support for width flag
https://github.com/bootandy/dust/issues/126

Requested because some people may cat the output

All terminal height/width detection is now in the main file. One method
now has too many args for clippy, this complaint is valid and in the
future we should consider pulling these out into a separate object.
2021-01-16 15:01:42 +00:00
andy.boot 360143ee91 Notes on how to publish 2021-01-16 14:56:45 +00:00
Alexandru Macovei 998e7fb2f8 Address clippy lints 2021-01-16 14:56:14 +00:00
Alexandru Macovei a48c7782ac Print correct message when paths are not found 2021-01-16 14:56:14 +00:00
andy.boot e0347b0b43 Fix: Stop adding extra output lines for multi args
If we provided n names we would previous output screen_height + n lines.
This is wrong. We should only print screen_height lines
2020-11-25 13:46:48 +00:00
andy.boot 5b6b449cbd Upgrade packages 2020-11-25 13:46:48 +00:00
andy.boot c8568e5674 Code cleanup from previous commit 2020-10-21 22:16:40 +01:00
Tyler Bailey 9d13994526 Cleanup (#121)
* remove unneeded identity .map()

* remove redunant field name in struct

* impl num_siblings for Node

* replace nested if w/ match in get_tree_chars

* remove unneeded field name in struct

* remove redundant println! & logic in display_node

* make get_children_from_node a Node method

* Revert "remove redundant println! & logic in display_node"

This reverts commit 40777025d5.
2020-10-21 22:01:18 +01:00
Sylvestre Ledru ca8b1efc18 Be less prescriptive for the ansi_term dep 2020-10-08 23:04:54 +01:00
oToToT c261492325 encode non-printable characters
use stfu8 to encode utf-8 characters
2020-10-08 22:57:01 +01:00
Thomas Gotwig 8d43185439 Publish on Homebrew on Linux 🍺🐧🎉 2020-10-03 09:42:27 +01:00
andy.boot 1d018bc80b Add test to check behaviour of -d flag
Covers the case fixed by the previous commit
2020-09-03 22:17:39 +01:00
andy.boot 2319c3032f Increment version for new release 2020-09-03 21:58:27 +01:00
8 changed files with 353 additions and 255 deletions
Generated
+215 -181
View File
@@ -2,494 +2,528 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.13" version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
dependencies = [ dependencies = [
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "memchr",
] ]
[[package]] [[package]]
name = "ansi_term" name = "ansi_term"
version = "0.11.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [ dependencies = [
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi",
] ]
[[package]] [[package]]
name = "ansi_term" name = "ansi_term"
version = "0.12.1" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [ dependencies = [
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi",
] ]
[[package]] [[package]]
name = "assert_cmd" name = "assert_cmd"
version = "1.0.1" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dc1679af9a1ab4bea16f228b05d18f8363f8327b1fa8db00d2760cfafc6b61e"
dependencies = [ dependencies = [
"doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "doc-comment",
"predicates 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "predicates",
"predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "predicates-core",
"predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "predicates-tree",
"wait-timeout 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "wait-timeout",
] ]
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [ dependencies = [
"hermit-abi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "hermit-abi",
"libc 0.2.74 (registry+https://github.com/rust-lang/crates.io-index)", "libc",
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi",
] ]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]] [[package]]
name = "bstr" name = "bstr"
version = "0.2.13" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf"
dependencies = [ dependencies = [
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "memchr",
] ]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "0.1.10" version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.33.3" version = "2.33.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
dependencies = [ dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.11.0",
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "atty",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags",
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim",
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap",
"unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width",
"vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map",
] ]
[[package]] [[package]]
name = "crossbeam-channel" name = "crossbeam-channel"
version = "0.4.3" version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
dependencies = [ dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.7.2",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "maybe-uninit",
] ]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.7.2" version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [ dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "autocfg",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
dependencies = [
"autocfg",
"cfg-if 1.0.0",
"lazy_static",
] ]
[[package]] [[package]]
name = "difference" name = "difference"
version = "2.0.0" version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
[[package]] [[package]]
name = "doc-comment" name = "doc-comment"
version = "0.3.3" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]] [[package]]
name = "du-dust" name = "du-dust"
version = "0.5.2" version = "0.5.4"
dependencies = [ dependencies = [
"ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.12.1",
"assert_cmd 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "assert_cmd",
"clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap",
"crossbeam-channel 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel",
"ignore 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)", "ignore",
"lscolors 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "lscolors",
"num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus",
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "stfu8",
"terminal_size 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile",
"thousands 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "terminal_size",
"unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "thousands",
"walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width",
"winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir",
"winapi-util",
] ]
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.7" version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.1.14" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6"
dependencies = [ dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0",
"libc 0.2.74 (registry+https://github.com/rust-lang/crates.io-index)", "libc",
"wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", "wasi",
] ]
[[package]] [[package]]
name = "globset" name = "globset"
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 = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a"
dependencies = [ dependencies = [
"aho-corasick 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)", "aho-corasick",
"bstr 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "bstr",
"fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "fnv",
"log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "log",
"regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "regex",
] ]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.15" version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
dependencies = [ dependencies = [
"libc 0.2.74 (registry+https://github.com/rust-lang/crates.io-index)", "libc",
] ]
[[package]] [[package]]
name = "ignore" name = "ignore"
version = "0.4.16" version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b287fb45c60bb826a0dc68ff08742b9d88a2fea13d6e0c286b3172065aaf878c"
dependencies = [ dependencies = [
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.1",
"globset 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "globset",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static",
"log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "log",
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "memchr",
"regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "regex",
"same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "same-file",
"thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local",
"walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir",
"winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util",
] ]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.74" version = "0.2.82"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929"
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.11" 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 = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2"
dependencies = [ dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10",
] ]
[[package]] [[package]]
name = "lscolors" name = "lscolors"
version = "0.7.1" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d24b894c45c9da468621cdd615a5a79ee5e5523dd4f75c76ebc03d458940c16e"
dependencies = [ dependencies = [
"ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.12.1",
] ]
[[package]] [[package]]
name = "memchr" name = "maybe-uninit"
version = "2.3.3" version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]]
name = "memchr"
version = "2.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
[[package]] [[package]]
name = "num_cpus" name = "num_cpus"
version = "1.13.0" version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
dependencies = [ dependencies = [
"hermit-abi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "hermit-abi",
"libc 0.2.74 (registry+https://github.com/rust-lang/crates.io-index)", "libc",
] ]
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.8" version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
[[package]] [[package]]
name = "predicates" name = "predicates"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73dd9b7b200044694dfede9edf907c1ca19630908443e9447e624993700c6932"
dependencies = [ dependencies = [
"difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "difference",
"predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "predicates-core",
] ]
[[package]] [[package]]
name = "predicates-core" name = "predicates-core"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb3dbeaaf793584e29c58c7e3a82bbb3c7c06b63cea68d13b0e3cddc124104dc"
[[package]] [[package]]
name = "predicates-tree" name = "predicates-tree"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aee95d988ee893cb35c06b148c80ed2cd52c8eea927f50ba7a0be1a786aeab73"
dependencies = [ dependencies = [
"predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "predicates-core",
"treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "treeline",
] ]
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.7.3" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18519b42a40024d661e1714153e9ad0c3de27cd495760ceb09710920f1098b1e"
dependencies = [ dependencies = [
"getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "libc",
"libc 0.2.74 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha",
"rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc",
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "rand_chacha" name = "rand_chacha"
version = "0.2.2" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [ dependencies = [
"ppv-lite86 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ppv-lite86",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core",
] ]
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.5.1" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5"
dependencies = [ dependencies = [
"getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "getrandom",
] ]
[[package]] [[package]]
name = "rand_hc" name = "rand_hc"
version = "0.2.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [ dependencies = [
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core",
] ]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.1.57" version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570"
dependencies = [
"bitflags",
]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.3.9" version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
dependencies = [ dependencies = [
"aho-corasick 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)", "aho-corasick",
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "memchr",
"regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax",
"thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local",
] ]
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.18" version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
[[package]] [[package]]
name = "remove_dir_all" name = "remove_dir_all"
version = "0.5.3" version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [ dependencies = [
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi",
] ]
[[package]] [[package]]
name = "same-file" name = "same-file"
version = "1.0.6" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
dependencies = [ dependencies = [
"winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util",
]
[[package]]
name = "stfu8"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bf70433e3300a3c395d06606a700cdf4205f4f14dbae2c6833127c6bb22db77"
dependencies = [
"lazy_static",
"regex",
] ]
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.8.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.1.0" version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [ dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0",
"libc 0.2.74 (registry+https://github.com/rust-lang/crates.io-index)", "libc",
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand",
"redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall",
"remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all",
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi",
] ]
[[package]] [[package]]
name = "terminal_size" name = "terminal_size"
version = "0.1.13" version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bd2d183bd3fac5f5fe38ddbeb4dc9aec4a39a9d7d59e7491d900302da01cbe1"
dependencies = [ dependencies = [
"libc 0.2.74 (registry+https://github.com/rust-lang/crates.io-index)", "libc",
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi",
] ]
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.11.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [ dependencies = [
"unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width",
] ]
[[package]] [[package]]
name = "thousands" name = "thousands"
version = "0.2.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820"
[[package]] [[package]]
name = "thread_local" name = "thread_local"
version = "1.0.1" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447"
dependencies = [ dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static",
] ]
[[package]] [[package]]
name = "treeline" name = "treeline"
version = "0.1.0" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.8" version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]] [[package]]
name = "vec_map" name = "vec_map"
version = "0.8.2" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "wait-timeout" name = "wait-timeout"
version = "0.2.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
dependencies = [ dependencies = [
"libc 0.2.74 (registry+https://github.com/rust-lang/crates.io-index)", "libc",
] ]
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.3.1" version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
dependencies = [ dependencies = [
"same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "same-file",
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi",
"winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util",
] ]
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.9.0+wasi-snapshot-preview1" version = "0.10.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9"
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.9" 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 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [ dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-x86_64-pc-windows-gnu",
] ]
[[package]] [[package]]
name = "winapi-i686-pc-windows-gnu" name = "winapi-i686-pc-windows-gnu"
version = "0.4.0" 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 = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]] [[package]]
name = "winapi-util" name = "winapi-util"
version = "0.1.5" version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [ dependencies = [
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi",
] ]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" 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"
[metadata]
"checksum aho-corasick 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)" = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
"checksum assert_cmd 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c88b9ca26f9c16ec830350d309397e74ee9abdfd8eb1f71cb6ecc71a3fc818da"
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum bstr 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
"checksum crossbeam-channel 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "09ee0cc8804d5393478d743b035099520087a5186f3b93fa58cec08fa62407b6"
"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
"checksum doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
"checksum globset 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7ad1da430bd7281dde2576f44c84cc3f0f7b475e7202cd503042dff01a8c8120"
"checksum hermit-abi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
"checksum ignore 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "22dcbf2a4a289528dbef21686354904e1c694ac642610a9bff9e7df730d9ec72"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.74 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10"
"checksum log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
"checksum lscolors 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d24b894c45c9da468621cdd615a5a79ee5e5523dd4f75c76ebc03d458940c16e"
"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
"checksum ppv-lite86 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
"checksum predicates 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96bfead12e90dccead362d62bb2c90a5f6fc4584963645bc7f71a735e0b0735a"
"checksum predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178"
"checksum predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124"
"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
"checksum regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
"checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
"checksum terminal_size 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9a14cd9f8c72704232f0bfc8455c0e861f0ad4eb60cc9ec8a170e231414c1e13"
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
"checksum thousands 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820"
"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
"checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
"checksum wait-timeout 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+3 -2
View File
@@ -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.5.2" version = "0.5.4"
authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"] authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"]
edition = "2018" edition = "2018"
@@ -21,7 +21,7 @@ name = "dust"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
ansi_term = "=0.12" ansi_term = "0.12"
clap = "=2.33" clap = "=2.33"
lscolors = "0.7" lscolors = "0.7"
num_cpus = "1" num_cpus = "1"
@@ -31,6 +31,7 @@ ignore="0.4"
crossbeam-channel = "0.4" crossbeam-channel = "0.4"
walkdir="2.3" walkdir="2.3"
thousands = "0.2" thousands = "0.2"
stfu8 = "0.2"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi-util = "0.1" winapi-util = "0.1"
+4
View File
@@ -22,6 +22,10 @@ Because I want an easy way to see where my disk is being used.
* `brew install dust` * `brew install dust`
#### 🍺 Homebrew (Linux)
* `brew tap tgotwig/linux-dust && brew install dust`
#### Download #### Download
* Download Linux/Mac binary from [Releases](https://github.com/bootandy/dust/releases) * Download Linux/Mac binary from [Releases](https://github.com/bootandy/dust/releases)
+2 -1
View File
@@ -1,5 +1,6 @@
# ----------- To do a release --------- # ----------- To do a release ---------
# tag a commit and push: # edit version in cargo.toml
# tag a commit and push (increment version first):
# git tag v0.4.5 # git tag v0.4.5
# git push origin v0.4.5 # git push origin v0.4.5
+30 -56
View File
@@ -1,14 +1,14 @@
extern crate ansi_term; extern crate ansi_term;
use crate::utils::Node; use crate::utils::{Errors, Node};
use self::ansi_term::Colour::Red; use self::ansi_term::Colour::Red;
use lscolors::{LsColors, Style}; use lscolors::{LsColors, Style};
use terminal_size::{terminal_size, Height, Width};
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use stfu8::encode_u8;
use std::cmp::max; use std::cmp::max;
use std::cmp::min; use std::cmp::min;
use std::fs; use std::fs;
@@ -18,7 +18,6 @@ use thousands::Separable;
static UNITS: [char; 4] = ['T', 'G', 'M', 'K']; static UNITS: [char; 4] = ['T', 'G', 'M', 'K'];
static BLOCKS: [char; 5] = ['█', '▓', '▒', '░', ' ']; static BLOCKS: [char; 5] = ['█', '▓', '▒', '░', ' '];
static DEFAULT_TERMINAL_WIDTH: u16 = 80;
pub struct DisplayData { pub struct DisplayData {
pub short_paths: bool, pub short_paths: bool,
@@ -32,32 +31,16 @@ pub struct DisplayData {
} }
impl DisplayData { impl DisplayData {
#[allow(clippy::collapsible_if)]
fn get_tree_chars(&self, was_i_last: bool, has_children: bool) -> &'static str { fn get_tree_chars(&self, was_i_last: bool, has_children: bool) -> &'static str {
if self.is_reversed { match (self.is_reversed, was_i_last, has_children) {
if was_i_last { (true, true, true) => "┌─┴",
if has_children { (true, true, false) => "┌──",
"─┴" (true, false, true) => "─┴",
} else { (true, false, false) => "├──",
"┌──" (false, true, true) => "└─┬",
} (false, true, false) => "└──",
} else if has_children { (false, false, true) => "├─┬",
"├─" (false, false, false) => "├─",
} else {
"├──"
}
} else {
if was_i_last {
if has_children {
"└─┬"
} else {
"└──"
}
} else if has_children {
"├─┬"
} else {
"├──"
}
} }
} }
@@ -87,15 +70,6 @@ impl DisplayData {
} }
} }
fn get_children_from_node(node: Node, is_reversed: bool) -> impl Iterator<Item = Node> {
if is_reversed {
let n: Vec<Node> = node.children.into_iter().rev().map(|a| a).collect();
n.into_iter()
} else {
node.children.into_iter()
}
}
struct DrawData<'a> { struct DrawData<'a> {
indent: String, indent: String,
percent_bar: String, percent_bar: String,
@@ -131,27 +105,23 @@ impl DrawData<'_> {
} }
} }
fn get_width_of_terminal() -> u16 { #[allow(clippy::too_many_arguments)]
// Windows CI runners detect a very low terminal width
if let Some((Width(w), Height(_h))) = terminal_size() {
max(w, DEFAULT_TERMINAL_WIDTH)
} else {
DEFAULT_TERMINAL_WIDTH
}
}
pub fn draw_it( pub fn draw_it(
permissions: bool, errors: Errors,
use_full_path: bool, use_full_path: bool,
is_reversed: bool, is_reversed: bool,
no_colors: bool, no_colors: bool,
no_percents: bool, no_percents: bool,
terminal_width: usize,
by_filecount: bool, by_filecount: bool,
root_node: Node, root_node: Node,
) { ) {
if !permissions { if errors.permissions {
eprintln!("Did not have permissions for all directories"); eprintln!("Did not have permissions for all directories");
} }
if errors.not_found {
eprintln!("Not all directories were found");
}
let num_chars_needed_on_left_most = if by_filecount { let num_chars_needed_on_left_most = if by_filecount {
let max_size = root_node.children.iter().map(|n| n.size).fold(0, max); let max_size = root_node.children.iter().map(|n| n.size).fold(0, max);
max_size.separate_with_commas().chars().count() max_size.separate_with_commas().chars().count()
@@ -159,7 +129,7 @@ pub fn draw_it(
5 // Under normal usage we need 5 chars to display the size of a directory 5 // Under normal usage we need 5 chars to display the size of a directory
}; };
let terminal_width = get_width_of_terminal() as usize - 9 - num_chars_needed_on_left_most; let terminal_width = terminal_width - 9 - num_chars_needed_on_left_most;
let num_indent_chars = 3; let num_indent_chars = 3;
let longest_string_length = root_node let longest_string_length = root_node
.children .children
@@ -175,7 +145,7 @@ pub fn draw_it(
let first_size_bar = repeat(BLOCKS[0]).take(max_bar_length).collect::<String>(); let first_size_bar = repeat(BLOCKS[0]).take(max_bar_length).collect::<String>();
for c in get_children_from_node(root_node, is_reversed) { for c in root_node.get_children_from_node(is_reversed) {
let display_data = DisplayData { let display_data = DisplayData {
short_paths: !use_full_path, short_paths: !use_full_path,
is_reversed, is_reversed,
@@ -232,9 +202,13 @@ fn display_node(node: Node, draw_data: &DrawData, is_biggest: bool, is_last: boo
percent_bar: bar_text, percent_bar: bar_text,
display_data: draw_data.display_data, display_data: draw_data.display_data,
}; };
let num_siblings = node.children.len() as u64;
for (count, c) in get_children_from_node(node, draw_data.display_data.is_reversed).enumerate() { let num_siblings = node.num_siblings();
for (count, c) in node
.get_children_from_node(draw_data.display_data.is_reversed)
.enumerate()
{
let is_biggest = dd.display_data.is_biggest(count, num_siblings); let is_biggest = dd.display_data.is_biggest(count, num_siblings);
let was_i_last = dd.display_data.is_last(count, num_siblings); let was_i_last = dd.display_data.is_last(count, num_siblings);
display_node(c, &dd, is_biggest, was_i_last); display_node(c, &dd, is_biggest, was_i_last);
@@ -277,7 +251,7 @@ fn get_printable_name<P: AsRef<Path>>(dir_name: &P, long_paths: bool) -> String
dir_name dir_name
} }
}; };
printable_name.display().to_string() encode_u8(printable_name.display().to_string().as_bytes())
} }
fn pad_or_trim_filename(node: &Node, indent: &str, display_data: &DisplayData) -> String { fn pad_or_trim_filename(node: &Node, indent: &str, display_data: &DisplayData) -> String {
@@ -325,7 +299,7 @@ fn get_name_percent(
bar_chart: &str, bar_chart: &str,
display_data: &DisplayData, display_data: &DisplayData,
) -> (String, String) { ) -> (String, String) {
if bar_chart != "" { if !bar_chart.is_empty() {
let percent_size_str = format!("{:.0}%", display_data.percent_size(node) * 100.0); let percent_size_str = format!("{:.0}%", display_data.percent_size(node) * 100.0);
let percents = format!("{}{:>4}", bar_chart, percent_size_str); let percents = format!("{}{:>4}", bar_chart, percent_size_str);
let name_and_padding = pad_or_trim_filename(node, indent, display_data); let name_and_padding = pad_or_trim_filename(node, indent, display_data);
@@ -398,7 +372,7 @@ mod tests {
by_filecount: false, by_filecount: false,
num_chars_needed_on_left_most: 5, num_chars_needed_on_left_most: 5,
base_size: 1, base_size: 1,
longest_string_length: longest_string_length, longest_string_length,
ls_colors: LsColors::from_env().unwrap_or_default(), ls_colors: LsColors::from_env().unwrap_or_default(),
} }
} }
+28 -4
View File
@@ -17,6 +17,7 @@ mod display;
mod utils; mod utils;
static DEFAULT_NUMBER_OF_LINES: usize = 30; static DEFAULT_NUMBER_OF_LINES: usize = 30;
static DEFAULT_TERMINAL_WIDTH: usize = 80;
#[cfg(windows)] #[cfg(windows)]
fn init_color(no_color: bool) -> bool { fn init_color(no_color: bool) -> bool {
@@ -52,6 +53,15 @@ fn get_height_of_terminal() -> usize {
} }
} }
fn get_width_of_terminal() -> usize {
// Windows CI runners detect a very low terminal width
if let Some((Width(w), Height(_h))) = terminal_size() {
max(w as usize, DEFAULT_TERMINAL_WIDTH)
} else {
DEFAULT_TERMINAL_WIDTH
}
}
fn main() { fn main() {
let default_height = get_height_of_terminal(); let default_height = get_height_of_terminal();
let def_num_str = default_height.to_string(); let def_num_str = default_height.to_string();
@@ -71,7 +81,7 @@ fn main() {
Arg::with_name("number_of_lines") Arg::with_name("number_of_lines")
.short("n") .short("n")
.long("number-of-lines") .long("number-of-lines")
.help("Number of lines of output to show") .help("Number of lines of output to show. This is Height, (but h is help)")
.takes_value(true) .takes_value(true)
.default_value(def_num_str.as_ref()), .default_value(def_num_str.as_ref()),
) )
@@ -132,6 +142,14 @@ fn main() {
.long("ignore_hidden") .long("ignore_hidden")
.help("Obey .git_ignore rules & Do not display hidden files"), .help("Obey .git_ignore rules & Do not display hidden files"),
) )
.arg(
Arg::with_name("width")
.short("w")
.long("terminal_width")
.takes_value(true)
.number_of_values(1)
.help("Specify width of output overriding the auto detection of terminal width"),
)
.arg(Arg::with_name("inputs").multiple(true)) .arg(Arg::with_name("inputs").multiple(true))
.get_matches(); .get_matches();
@@ -151,6 +169,11 @@ fn main() {
} }
}; };
let terminal_width = match value_t!(options.value_of("width"), usize) {
Ok(v) => v,
Err(_) => get_width_of_terminal(),
};
let depth = options.value_of("depth").and_then(|depth| { let depth = options.value_of("depth").and_then(|depth| {
depth depth
.parse::<usize>() .parse::<usize>()
@@ -174,7 +197,7 @@ fn main() {
let show_hidden = !options.is_present("ignore_hidden"); let show_hidden = !options.is_present("ignore_hidden");
let simplified_dirs = simplify_dir_names(target_dirs); let simplified_dirs = simplify_dir_names(target_dirs);
let (permissions, nodes) = get_dir_tree( let (errors, nodes) = get_dir_tree(
&simplified_dirs, &simplified_dirs,
&ignore_directories, &ignore_directories,
use_apparent_size, use_apparent_size,
@@ -185,18 +208,19 @@ fn main() {
let sorted_data = sort(nodes); let sorted_data = sort(nodes);
let biggest_ones = { let biggest_ones = {
match depth { match depth {
None => find_big_ones(sorted_data, number_of_lines + simplified_dirs.len()), None => find_big_ones(sorted_data, number_of_lines),
Some(_) => sorted_data, Some(_) => sorted_data,
} }
}; };
let tree = build_tree(biggest_ones, depth); let tree = build_tree(biggest_ones, depth);
draw_it( draw_it(
permissions, errors,
options.is_present("display_full_paths"), options.is_present("display_full_paths"),
!options.is_present("reverse"), !options.is_present("reverse"),
no_colors, no_colors,
options.is_present("no_bars"), options.is_present("no_bars"),
terminal_width,
by_filecount, by_filecount,
tree, tree,
); );
+54 -11
View File
@@ -1,7 +1,6 @@
use std::cmp::Ordering; use std::cmp::Ordering;
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::HashSet; use std::collections::HashSet;
use std::iter::FromIterator;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
@@ -17,7 +16,7 @@ use self::platform::*;
type PathData = (PathBuf, u64, Option<(u64, u64)>); type PathData = (PathBuf, u64, Option<(u64, u64)>);
#[derive(Debug, Default, Eq)] #[derive(Debug, Default, Eq, Clone)]
pub struct Node { pub struct Node {
pub name: PathBuf, pub name: PathBuf,
pub size: u64, pub size: u64,
@@ -46,6 +45,26 @@ impl PartialEq for Node {
} }
} }
impl Node {
pub fn num_siblings(&self) -> u64 {
self.children.len() as u64
}
pub fn get_children_from_node(&self, is_reversed: bool) -> impl Iterator<Item = Node> {
if is_reversed {
let children: Vec<Node> = self.children.clone().into_iter().rev().collect();
children.into_iter()
} else {
self.children.clone().into_iter()
}
}
}
pub struct Errors {
pub permissions: bool,
pub not_found: bool,
}
pub fn is_a_parent_of<P: AsRef<Path>>(parent: P, child: P) -> bool { pub fn is_a_parent_of<P: AsRef<Path>>(parent: P, child: P) -> bool {
let parent = parent.as_ref(); let parent = parent.as_ref();
let child = child.as_ref(); let child = child.as_ref();
@@ -104,6 +123,18 @@ fn prepare_walk_dir_builder<P: AsRef<Path>>(
builder builder
} }
fn is_not_found(e: &ignore::Error) -> bool {
use ignore::Error;
if let Error::WithPath { err, .. } = e {
if let Error::Io(e) = &**err {
if e.kind() == std::io::ErrorKind::NotFound {
return true;
}
}
}
false
}
pub fn get_dir_tree<P: AsRef<Path>>( pub fn get_dir_tree<P: AsRef<Path>>(
top_level_names: &HashSet<P>, top_level_names: &HashSet<P>,
ignore_directories: &Option<Vec<PathBuf>>, ignore_directories: &Option<Vec<PathBuf>>,
@@ -111,12 +142,16 @@ pub fn get_dir_tree<P: AsRef<Path>>(
limit_filesystem: bool, limit_filesystem: bool,
by_filecount: bool, by_filecount: bool,
show_hidden: bool, show_hidden: bool,
) -> (bool, HashMap<PathBuf, u64>) { ) -> (Errors, HashMap<PathBuf, u64>) {
let (tx, rx) = channel::bounded::<PathData>(1000); let (tx, rx) = channel::bounded::<PathData>(1000);
let permissions_flag = AtomicBool::new(true); let permissions_flag = AtomicBool::new(false);
let not_found_flag = AtomicBool::new(false);
let t2 = HashSet::from_iter(top_level_names.iter().map(|p| p.as_ref().to_path_buf())); let t2 = top_level_names
.iter()
.map(|p| p.as_ref().to_path_buf())
.collect();
let t = create_reader_thread(rx, t2, apparent_size); let t = create_reader_thread(rx, t2, apparent_size);
let walk_dir_builder = prepare_walk_dir_builder(top_level_names, limit_filesystem, show_hidden); let walk_dir_builder = prepare_walk_dir_builder(top_level_names, limit_filesystem, show_hidden);
@@ -124,6 +159,7 @@ pub fn get_dir_tree<P: AsRef<Path>>(
walk_dir_builder.build_parallel().run(|| { walk_dir_builder.build_parallel().run(|| {
let txc = tx.clone(); let txc = tx.clone();
let pf = &permissions_flag; let pf = &permissions_flag;
let nf = &not_found_flag;
Box::new(move |path| { Box::new(move |path| {
match path { match path {
Ok(p) => { Ok(p) => {
@@ -131,9 +167,8 @@ pub fn get_dir_tree<P: AsRef<Path>>(
let path = p.path(); let path = p.path();
let parts = path.components().collect::<Vec<std::path::Component>>(); let parts = path.components().collect::<Vec<std::path::Component>>();
for d in dirs { for d in dirs {
let seq = d.components().collect::<Vec<std::path::Component>>();
if parts if parts
.windows(seq.len()) .windows(d.components().count())
.any(|window| window.iter().collect::<PathBuf>() == *d) .any(|window| window.iter().collect::<PathBuf>() == *d)
{ {
return WalkState::Continue; return WalkState::Continue;
@@ -150,12 +185,16 @@ pub fn get_dir_tree<P: AsRef<Path>>(
txc.send((p.into_path(), size, inode_device)).unwrap(); txc.send((p.into_path(), size, inode_device)).unwrap();
} }
None => { None => {
pf.store(false, atomic::Ordering::Relaxed); pf.store(true, atomic::Ordering::Relaxed);
} }
} }
} }
Err(_) => { Err(e) => {
pf.store(false, atomic::Ordering::Relaxed); if is_not_found(&e) {
nf.store(true, atomic::Ordering::Relaxed);
} else {
pf.store(true, atomic::Ordering::Relaxed);
}
} }
}; };
WalkState::Continue WalkState::Continue
@@ -164,7 +203,11 @@ pub fn get_dir_tree<P: AsRef<Path>>(
drop(tx); drop(tx);
let data = t.join().unwrap(); let data = t.join().unwrap();
(permissions_flag.load(atomic::Ordering::SeqCst), data) let errors = Errors {
permissions: permissions_flag.load(atomic::Ordering::SeqCst),
not_found: not_found_flag.load(atomic::Ordering::SeqCst),
};
(errors, data)
} }
fn create_reader_thread( fn create_reader_thread(
+17
View File
@@ -65,6 +65,23 @@ pub fn test_d_flag_works() {
assert!(!output.contains("hello_file")); assert!(!output.contains("hello_file"));
} }
#[test]
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
// would fail to recurse down
let mut cmd = Command::cargo_bin("dust").unwrap();
let output = cmd
.arg("-d")
.arg("1")
.arg("-f")
.arg("-c")
.arg("tests/test_dir2/")
.unwrap()
.stdout;
let output = str::from_utf8(&output).unwrap();
assert!(output.contains("7 ┌─┴ test_dir2"));
}
// Check against directories and files whos names are substrings of each other // Check against directories and files whos names are substrings of each other
#[test] #[test]
pub fn test_ignore_dir() { pub fn test_ignore_dir() {