From 553e65c87df0fc3cbbaaa2d9fb832db47321f557 Mon Sep 17 00:00:00 2001 From: Canop Date: Thu, 3 Aug 2023 20:21:15 +0200 Subject: Add examples to --help --- CHANGELOG.md | 4 + Cargo.lock | 14 +- Cargo.toml | 6 +- bacon.toml | 6 +- cli/Cargo.lock | 862 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ cli/Cargo.toml | 4 +- cli/src/help.rs | 111 ++++++++ cli/src/lib.rs | 15 +- 8 files changed, 993 insertions(+), 29 deletions(-) create mode 100644 cli/Cargo.lock create mode 100644 cli/src/help.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index e87af8b..65298e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ + +### v2.7.2 - 2023/08/03 +- examples in `--help` + ### v2.7.1 - 2023/07/16 - improved `--help` diff --git a/Cargo.lock b/Cargo.lock index 1203c48..5b902da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,12 +109,12 @@ dependencies = [ [[package]] name = "clap-help" -version = "0.4.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74090d11d4d740737b1020449d928ae0d91f72dc33a8c6c2f5c9b37659c5d54f" +checksum = "4f06bd287cb07754f8337478ac48ce3737ddbcf729345a607338ffcdff0d908c" dependencies = [ "clap", - "termimad 0.23.1", + "termimad 0.23.2", "terminal-light", ] @@ -283,7 +283,7 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dysk" -version = "2.7.1" +version = "2.7.2" dependencies = [ "clap", "clap_complete", @@ -293,7 +293,7 @@ dependencies = [ [[package]] name = "dysk-cli" -version = "2.7.1" +version = "2.7.2" dependencies = [ "bet", "clap", @@ -717,9 +717,9 @@ dependencies = [ [[package]] name = "termimad" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7df2ed35b86d796df56633f1bb1f0c15816134e221822d65bbc64d5265ce8d4" +checksum = "2e32883199fc52cda7e431958dee8bc3ec6898afabc152b76959b9e0e74e2202" dependencies = [ "coolor", "crossbeam", diff --git a/Cargo.toml b/Cargo.toml index 874e771..d71a9f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dysk" -version = "2.7.1" +version = "2.7.2" authors = ["dystroy "] edition = "2021" keywords = ["linux", "filesystem", "fs", "lfs", "disk"] @@ -16,13 +16,13 @@ exclude = ["website", "dysk*.zip"] build = "build.rs" [dependencies] -dysk-cli = { version = "2.7.1", path = "cli" } # beware: version is also in build dependencies +dysk-cli = { version = "2.7.2", path = "cli" } # beware: version is also in build dependencies [build-dependencies] clap = { version = "4.3", features = ["derive", "cargo"] } clap_complete = "4.3" clap_mangen = "0.2.12" -dysk-cli = { version = "2.7.1", path = "cli" } +dysk-cli = { version = "2.7.2", path = "cli" } [profile.release] strip = true diff --git a/bacon.toml b/bacon.toml index 434d791..0ef636a 100644 --- a/bacon.toml +++ b/bacon.toml @@ -6,10 +6,6 @@ default_job = "check" [jobs] [jobs.check] -command = ["cargo", "check", "--color", "always"] -need_stdout = false - -[jobs.check-all] command = ["cargo", "check", "--all-targets", "--color", "always"] need_stdout = false watch = ["tests", "benches", "examples"] @@ -24,7 +20,7 @@ need_stdout = false watch = ["tests", "benches", "examples"] [jobs.test] -command = ["cargo", "test", "--color", "always"] +command = ["cargo", "test", "--all-targets", "--color", "always"] need_stdout = true watch = ["tests"] diff --git a/cli/Cargo.lock b/cli/Cargo.lock new file mode 100644 index 0000000..db58a23 --- /dev/null +++ b/cli/Cargo.lock @@ -0,0 +1,862 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" + +[[package]] +name = "anstyle-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bet" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1673d13ad9c8d4b5e3d17a38730714157d428d1a249c18dd96e77e969623ac98" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + +[[package]] +name = "cc" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c6b2562119bf28c3439f7f02db99faf0aa1a8cdfe5772a2ee155d32227239f0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +dependencies = [ + "clap_builder", + "clap_derive", + "once_cell", +] + +[[package]] +name = "clap-help" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f06bd287cb07754f8337478ac48ce3737ddbcf729345a607338ffcdff0d908c" +dependencies = [ + "clap", + "termimad 0.23.2", + "terminal-light", +] + +[[package]] +name = "clap_builder" +version = "4.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "once_cell", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "clap_lex" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "coolor" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af4d7a805ca0d92f8c61a31c809d4323fdaa939b0b440e544d21db7797c5aaad" +dependencies = [ + "crossterm", +] + +[[package]] +name = "crossbeam" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" +dependencies = [ + "cfg-if", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset 0.9.0", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossterm" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2102ea4f781910f8a5b98dd061f4c2023f479ce7bb1236330099ceb5a93cf17" +dependencies = [ + "bitflags 1.3.2", + "crossterm_winapi", + "libc", + "mio", + "parking_lot", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "dysk-cli" +version = "2.7.2" +dependencies = [ + "bet", + "clap", + "clap-help", + "crossterm", + "file-size", + "lfs-core", + "serde", + "serde_json", + "termimad 0.20.6", +] + +[[package]] +name = "errno" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "file-size" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9544f10105d33957765016b8a9baea7e689bf1f0f2f32c2fa2f568770c38d2b3" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "lazy-regex" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff63c423c68ea6814b7da9e88ce585f793c87ddd9e78f646970891769c8235d4" +dependencies = [ + "lazy-regex-proc_macros", + "once_cell", + "regex", +] + +[[package]] +name = "lazy-regex-proc_macros" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8edfc11b8f56ce85e207e62ea21557cfa09bb24a8f6b04ae181b086ff8611c22" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", +] + +[[package]] +name = "lfs-core" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4441d37490f59d2fdc631e6be973ce8712435e4bfebe9615125b11603cd41f" +dependencies = [ + "lazy-regex", + "libc", + "snafu", +] + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimad" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "277639f0198568f70f8fe4ab88a52a67c96bca12f27ba5c17a76acdcb8b45834" +dependencies = [ + "once_cell", +] + +[[package]] +name = "minimad" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b136454924e4d020e55c4992e07c105b40d5c41b84662862f0e15bc0a2efef" +dependencies = [ + "once_cell", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys", +] + +[[package]] +name = "nix" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" +dependencies = [ + "bitflags 1.3.2", + "cc", + "cfg-if", + "libc", + "memoffset 0.6.5", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" + +[[package]] +name = "rustix" +version = "0.38.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee020b1716f0a80e2ace9b03441a749e402e86712f15f16fe8a8f75afac732f" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea67f183f058fe88a4e3ec6e2788e003840893b91bac4559cabedd00863b3ed" + +[[package]] +name = "serde_json" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "signal-hook" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "snafu" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" +dependencies = [ + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termimad" +version = "0.20.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfab44b4bc17601cf226cce31c87462a4a5bd5d325948c8ebbc9e715660a1287" +dependencies = [ + "coolor", + "crossbeam", + "crossterm", + "minimad 0.9.1", + "thiserror", + "unicode-width", +] + +[[package]] +name = "termimad" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e32883199fc52cda7e431958dee8bc3ec6898afabc152b76959b9e0e74e2202" +dependencies = [ + "coolor", + "crossbeam", + "crossterm", + "minimad 0.12.0", + "thiserror", + "unicode-width", +] + +[[package]] +name = "terminal-light" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9077b39afb70f12391e4c1fcf46319999cfc32b45d605a668052bc4d1b4511af" +dependencies = [ + "coolor", + "crossterm", + "thiserror", + "xterm-query", +] + +[[package]] +name = "thiserror" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "xterm-query" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec02abe9c7efbcb010adc0d90bc4a054653477cd4a3eb8eef5a689799c146a13" +dependencies = [ + "mio", + "nix", + "thiserror", +] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index b95afda..97e266f 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dysk-cli" -version = "2.7.1" +version = "2.7.2" authors = ["dystroy "] edition = "2021" license = "MIT" @@ -10,7 +10,7 @@ rust-version = "1.59" [dependencies] bet = "1.0.0" clap = { version = "4.3", features = ["derive", "cargo"] } -clap-help = "0.4.0" +clap-help = "0.6.2" crossterm = "0.23.2" file-size = "1.0.3" lfs-core = "0.11.0" diff --git a/cli/src/help.rs b/cli/src/help.rs new file mode 100644 index 0000000..ee6851d --- /dev/null +++ b/cli/src/help.rs @@ -0,0 +1,111 @@ +use { + crate::{ + args::*, + }, + clap::CommandFactory, +}; + +static INTRO_TEMPLATE: &str = " +**dysk** displays filesystem information in a pretty table. +Complete documentation at https://dystroy.org/dysk + +"; + +static EXAMPLES_TEMPLATE: &str = " +**Examples:** + +${examples +**${example-number})** ${example-title}: `${example-cmd}` +${example-comments} +} +"; + +static EXAMPLES: &[Example] = &[ + Example::new( + "Standard overview of your usual disks", + "dysk", + "" + ), + Example::new( + "List all filesystems", + "dysk -a", + "" + ), + Example::new( + "Display inodes information", + "dysk -c +inodes", + "" + ), + Example::new( + "Add columns of your choice", + "dysk -c label+dev+", + "You may add columns before, after, or at any other place. \ + You can change the column order too. \ + See https://dystroy.org/dysk/table#columns\n" + ), + Example::new( + "See the disk of the current directory", + "dysk .", + "" + ), + Example::new( + "Filter for low space", + "dysk -f 'use > 65% | free < 50G'", + "" + ), + Example::new( + "Filter to exclude SSD disks", + "dysk -f 'disk <> SSD'", + "" + ), + Example::new( + "Complex filter", + "dysk -f '(type=xfs & remote=no) | size > 5T'", + "" + ), + Example::new( + "Export as JSON", + "dysk -j", + "" + ), + Example::new( + "Sort by free size", + "dysk -s free", + "Add `-desc` to the column name to sort in reverse." + ), +]; + +pub fn print() { + let mut printer = clap_help::Printer::new(Args::command()) + .with("introduction", INTRO_TEMPLATE) + .without("author"); + printer.template_keys_mut().push("examples"); + printer.set_template("examples", EXAMPLES_TEMPLATE); + for (i, example) in EXAMPLES.iter().enumerate() { + printer + .expander_mut() + .sub("examples") + .set("example-number", i + 1) + .set("example-title", example.title) + .set("example-cmd", example.cmd) + .set_md("example-comments", example.comments); + } + printer.print_help(); +} + +struct Example { + title: &'static str, + cmd: &'static str, + comments: &'static str, +} + +impl Example { + pub const fn new( + title: &'static str, + cmd: &'static str, + comments: &'static str, + ) -> Self { + Self { title, cmd, comments } + } +} + diff --git a/cli/src/lib.rs b/cli/src/lib.rs index df78838..64fd253 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -4,6 +4,7 @@ pub mod col_expr; pub mod cols; pub mod csv; pub mod filter; +pub mod help; pub mod json; pub mod list_cols; pub mod normal; @@ -17,20 +18,13 @@ use { args::*, normal::*, }, - clap::{CommandFactory, Parser}, + clap::Parser, std::{ fs, os::unix::fs::MetadataExt, }, }; -static INTRO: &str = " - -**dysk** displays filesystem information in a pretty table. -Complete documentation at https://dystroy.org/dysk - -"; - #[allow(clippy::match_like_matches_macro)] pub fn run() { @@ -40,10 +34,7 @@ pub fn run() { return; } if args.help { - clap_help::Printer::new(Args::command()) - .with("introduction", INTRO) - .without("author") - .print_help(); + help::print(); return; } if args.list_cols { -- cgit v1.2.3 From c0caf31c137fe25e33f1cdb7ecd5b3b5512d11f3 Mon Sep 17 00:00:00 2001 From: Canop Date: Thu, 3 Aug 2023 20:34:21 +0200 Subject: fix a cross-compilation problem --- compile-all-targets.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/compile-all-targets.sh b/compile-all-targets.sh index 610ef09..4f4a004 100755 --- a/compile-all-targets.sh +++ b/compile-all-targets.sh @@ -38,6 +38,7 @@ cross_build() { name="$1" target="$2" echo -e "${H2}Compiling the $name / $target version${EH}" + cargo clean cross build --target "$target" --release mkdir "build/$target" cp "target/$target/release/dysk" "build/$target/" -- cgit v1.2.3 From ae750767221ce2b6c1c527b0d7d1dd0ea5ba04f7 Mon Sep 17 00:00:00 2001 From: Canop Date: Fri, 4 Aug 2023 09:30:21 +0200 Subject: reorganize compile script (so that the local release exe is present at end) --- compile-all-targets.sh | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/compile-all-targets.sh b/compile-all-targets.sh index 4f4a004..b1d32ea 100755 --- a/compile-all-targets.sh +++ b/compile-all-targets.sh @@ -16,9 +16,25 @@ rm -rf build mkdir build echo " build cleaned" +# build versions for other platforms using cargo cross +cross_build() { + name="$1" + target="$2" + echo -e "${H2}Compiling the $name / $target version${EH}" + cargo clean + cross build --target "$target" --release + mkdir "build/$target" + cp "target/$target/release/dysk" "build/$target/" +} +cross_build "Raspberry 32" "armv7-unknown-linux-gnueabihf" +# cross_build "Android" "aarch64-linux-android" +cross_build "MUSL" "x86_64-unknown-linux-musl" +cross_build "NetBSD/amd64" "x86_64-unknown-netbsd" + # build the linux version target="x86_64-linux" echo -e "${H2}Compiling the linux version - $target${EH}" +cargo clean cargo build --release mkdir "build/$target/" cp target/release/dysk "build/$target/" @@ -33,19 +49,4 @@ mkdir build/man mv build/completion/dysk.1 build/man echo " Done" -# build versions for other platforms using cargo cross -cross_build() { - name="$1" - target="$2" - echo -e "${H2}Compiling the $name / $target version${EH}" - cargo clean - cross build --target "$target" --release - mkdir "build/$target" - cp "target/$target/release/dysk" "build/$target/" -} -cross_build "Raspberry 32" "armv7-unknown-linux-gnueabihf" -# cross_build "Android" "aarch64-linux-android" -cross_build "MUSL" "x86_64-unknown-linux-musl" -cross_build "NetBSD/amd64" "x86_64-unknown-netbsd" - echo -e "${H1}Compilations done${EH}" -- cgit v1.2.3 From e17dcd5f8258b8d05ec86ebd078bdd3aacceb0eb Mon Sep 17 00:00:00 2001 From: Canop Date: Fri, 4 Aug 2023 15:28:44 +0200 Subject: add repology badge Fix #60 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c14d3ee..654c20a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # dysk -[![CI][s3]][l3] [![MIT][s2]][l2] [![Latest Version][s1]][l1] [![Chat on Miaou][s4]][l4] +[![CI][s3]][l3] [![MIT][s2]][l2] [![Latest Version][s1]][l1] [![Chat on Miaou][s4]][l4] [![Packaging status][srep]][lrep] [s1]: https://img.shields.io/crates/v/dysk.svg [l1]: https://crates.io/crates/dysk @@ -14,6 +14,8 @@ [s4]: https://miaou.dystroy.org/static/shields/room.svg [l4]: https://miaou.dystroy.org/3768?Rust +[srep]: https://repology.org/badge/tiny-repos/dysk.svg +[lrep]: https://repology.org/project/dysk/versions A linux utility listing your filesystems. -- cgit v1.2.3