Merge pull request #147 from QuarticCat/master

Beautify help messages
This commit is contained in:
andy.boot
2021-06-08 10:40:34 +01:00
committed by GitHub
3 changed files with 19 additions and 12 deletions
Generated
+12
View File
@@ -91,6 +91,7 @@ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"strsim", "strsim",
"term_size",
"textwrap", "textwrap",
"unicode-width", "unicode-width",
"vec_map", "vec_map",
@@ -412,6 +413,16 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "term_size"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9"
dependencies = [
"libc",
"winapi",
]
[[package]] [[package]]
name = "terminal_size" name = "terminal_size"
version = "0.1.17" version = "0.1.17"
@@ -428,6 +439,7 @@ 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" checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [ dependencies = [
"term_size",
"unicode-width", "unicode-width",
] ]
+1 -2
View File
@@ -22,7 +22,7 @@ path = "src/main.rs"
[dependencies] [dependencies]
ansi_term = "0.12" ansi_term = "0.12"
clap = "=2.33" clap = { version = "=2.33", features = ["wrap_help"] }
lscolors = "0.7" lscolors = "0.7"
num_cpus = "1" num_cpus = "1"
terminal_size = "0.1" terminal_size = "0.1"
@@ -40,7 +40,6 @@ winapi-util = "0.1"
assert_cmd = "1" assert_cmd = "1"
tempfile = "=3" tempfile = "=3"
[[test]] [[test]]
name = "integration" name = "integration"
path = "tests/tests.rs" path = "tests/tests.rs"
+2 -6
View File
@@ -75,7 +75,8 @@ fn main() {
.short("d") .short("d")
.long("depth") .long("depth")
.help("Depth to show") .help("Depth to show")
.takes_value(true), .takes_value(true)
.conflicts_with("number_of_lines"),
) )
.arg( .arg(
Arg::with_name("number_of_lines") Arg::with_name("number_of_lines")
@@ -150,7 +151,6 @@ fn main() {
.number_of_values(1) .number_of_values(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::with_name("inputs").multiple(true)) .arg(Arg::with_name("inputs").multiple(true))
.get_matches(); .get_matches();
@@ -181,10 +181,6 @@ fn main() {
.map_err(|_| eprintln!("Ignoring bad value for depth")) .map_err(|_| eprintln!("Ignoring bad value for depth"))
.ok() .ok()
}); });
if options.is_present("depth") && number_of_lines != default_height {
eprintln!("Use either -n or -d. Not both");
return;
}
let no_colors = init_color(options.is_present("no_colors")); let no_colors = init_color(options.is_present("no_colors"));
let use_apparent_size = options.is_present("display_apparent_size"); let use_apparent_size = options.is_present("display_apparent_size");