Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
cli: port from structopt to clap v4
Browse files Browse the repository at this point in the history
  • Loading branch information
decathorpe committed Mar 14, 2023
1 parent 6371ba0 commit 54f1bda
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 713 deletions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@ path = "src/main.rs"

[dependencies]
bodhi = "2.0.1"
chrono = { version = "0.4.19", default-features = false }
chrono = { version = "0.4.19", features = ["clock", "std"], default-features = false }
clap = { version = "4", features = ["derive", "color", "suggestions", "wrap_help"]}
dirs = "4"
rpassword = "5.0.1"
secret-service = "2.0.1"
serde = { version = "1.0.134", features = ["derive"] }
serde_json = "1.0.78"
structopt = { version = "0.3.25", features = ["color", "suggestions", "wrap_help"] }
term_size = "0.3.2"
tokio = { version = "1.14", features = ["fs", "macros", "rt-multi-thread"] }
toml = "0.5.8"

[build-dependencies]
bodhi = "2.0.1"
structopt = "0.3.25"
clap = { version = "4", features = ["derive"]}
clap_complete = "4"

[profile.release]
codegen-units = 1
Expand Down
13 changes: 9 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
use structopt::clap::Shell;
use clap::CommandFactory;
use clap_complete::{generate_to, Shell};

include!("src/cli.rs");

fn main() {
let outdir = std::env::var("OUT_DIR").unwrap();
let mut app = BaseCommand::clap();
app.gen_completions("bodhi-cli", Shell::Bash, outdir);
let out_dir = std::env::var("OUT_DIR").unwrap();
let bin_name = std::env::var("CARGO_PKG_NAME").unwrap();
let mut command = BaseCommand::command();

generate_to(Shell::Bash, &mut command, &bin_name, &out_dir).unwrap();
generate_to(Shell::Fish, &mut command, &bin_name, &out_dir).unwrap();
generate_to(Shell::Zsh, &mut command, &bin_name, &out_dir).unwrap();
}
Loading

0 comments on commit 54f1bda

Please sign in to comment.