ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: switch from clap's Builder API to its Derive API

The Derive API is easier to work with, less error-prone, and less
verbose, so it seems like a good improvement.

It was quite a bit of work to make the switch, and I'll be surprised
if I didn't make any mistakes in the translation. We unfortunately
don't have enough e2e tests to be very confident, so we'll have to fix
any problems as we discover them.

I've at least verified that the output of `jj debug completion --fish`
is unchanged, except for a few help texts I changed for different
reasons (consistency, clarity, avoiding redundancy).
This commit is contained in:
Martin von Zweigbergk 2022-03-22 15:11:28 -07:00 committed by Martin von Zweigbergk
parent 11afbc70f9
commit 66fe23b4e9
3 changed files with 1202 additions and 1266 deletions

20
Cargo.lock generated
View file

@ -219,6 +219,7 @@ checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"indexmap",
"lazy_static",
"os_str_bytes",
@ -236,6 +237,19 @@ dependencies = [
"clap 3.1.6",
]
[[package]]
name = "clap_derive"
version = "3.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da95d038ede1a964ce99f49cbe27a7fb538d1da595e4b4f70b8c8f338d17bf16"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_mangen"
version = "0.1.2"
@ -573,6 +587,12 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"

View file

@ -27,7 +27,7 @@ members = ["lib"]
assert_cmd = "2.0.4"
atty = "0.2.14"
chrono = "0.4.19"
clap = { version = "3.1.6", features = ["cargo"] }
clap = { version = "3.1.6", features = ["derive"] }
clap_complete = "3.1.1"
clap_mangen = "0.1"
config = "0.12.0"

File diff suppressed because it is too large Load diff