From 31f71f29bf4f1b0f4efafe49f44fc69070284e29 Mon Sep 17 00:00:00 2001 From: Oscar Bonilla <6f6231@gmail.com> Date: Tue, 22 Aug 2023 21:30:02 -0700 Subject: [PATCH] Enable wrapping help in clap --- Cargo.lock | 50 ++++++++++++++++++++++++++++++++--- Cargo.toml | 2 +- cli/tests/test_global_opts.rs | 3 ++- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f64dd1006..6a8891a2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -352,6 +352,7 @@ dependencies = [ "anstyle", "clap_lex", "strsim", + "terminal_size", ] [[package]] @@ -929,6 +930,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "iovec" version = "0.1.4" @@ -945,7 +957,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -1047,7 +1059,7 @@ dependencies = [ "rand_chacha", "rayon", "regex", - "rustix", + "rustix 0.38.8", "serde", "serde_json", "smallvec", @@ -1140,6 +1152,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "linux-raw-sys" version = "0.4.5" @@ -1758,6 +1776,20 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustix" +version = "0.37.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + [[package]] name = "rustix" version = "0.38.8" @@ -1767,7 +1799,7 @@ dependencies = [ "bitflags 2.3.3", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.5", "windows-sys 0.48.0", ] @@ -1984,7 +2016,17 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix", + "rustix 0.38.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "terminal_size" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" +dependencies = [ + "rustix 0.37.23", "windows-sys 0.48.0", ] diff --git a/Cargo.toml b/Cargo.toml index 68988c99b..b0c229ed4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ blake2 = "0.10.6" byteorder = "1.4.3" bytes = "1.4.0" cargo_metadata = "0.17.0" -clap = { version = "4.3.23", features = ["derive", "deprecated"] } +clap = { version = "4.3.23", features = ["derive", "deprecated", "wrap_help"] } clap_complete = "4.3.2" clap_mangen = "0.2.10" chrono = { version = "0.4.26", default-features = false, features = [ diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index ed775d4d0..853f66110 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -417,7 +417,8 @@ fn test_help() { Usage: jj diffedit [OPTIONS] Options: - -r, --revision The revision to touch up. Defaults to @ if neither --to nor --from are specified + -r, --revision The revision to touch up. Defaults to @ if neither --to nor --from are + specified --from Show changes from this revision. Defaults to @ if --to is specified --to Edit changes in this revision. Defaults to @ if --from is specified -h, --help Print help (see more with '--help')