Skip to content

Commit

Permalink
Port to clap 4, drop custom derive (#1142)
Browse files Browse the repository at this point in the history
Move the CLI over to clap-4.4.6, drop `EdbClap` and use clap's
derive instead.

Custom derive allowed is to implement various hacks and logic in
argument propagation and annotation, but the cost of maintaining what is
essentially an old fork of `clap::_derive` is quite high and stands in
the way of easy `clap` upgrades and the ability to use its newer
features.

Fortunately, I've been able to find ways to achieve the same argument
propagation behavior with normal `global` args and a little bit of
hackery at app initialization, so instead of doing

    #[edb(inherit(CloudOptions))]
    command or subcommand

you should now do

    #[command(flatten)]
    pub cloud_opts: CloudOptions

in the parent command of where you want to begin propagation.  Though
this is slightly more verbose (the current derive is a bit more magical
about propagation), this approach has the benefit of making the options
available closer to the actual subcommand as opposed to passing the
root `Options` all the way through, but I've left that cleanup for
later.
  • Loading branch information
elprans authored Oct 17, 2023
1 parent fcfe027 commit 59f8064
Show file tree
Hide file tree
Showing 35 changed files with 1,056 additions and 2,180 deletions.
199 changes: 173 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ bytes = "1.0.1"
blake2b_simd = "1.0.0"
blake3 = "1.1.0"
rustyline = { git="https://github.com/tailhook/rustyline", branch="edgedb_20210403"}
clap = {version="3.2.23", features=["derive", "cargo"]}
clap_complete = "3.2.5"
clap = {version="4.4.6", features=["derive", "cargo", "deprecated", "wrap_help"]}
clap_complete = "4.4.3"
color-print = "0.3.5"
strsim = "0.10.0"
whoami = "1.1"
is-terminal = "0.4.4"
Expand Down
Loading

0 comments on commit 59f8064

Please sign in to comment.