Update clap to 3.1
This commit is contained in:
parent
293fcc53ff
commit
2f1202e8c5
73
Cargo.lock
generated
73
Cargo.lock
generated
@ -2,15 +2,6 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
@ -60,17 +51,17 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
version = "3.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
|
||||
checksum = "759e998e8d87a8b7a2c11a0e029d8772632fd3346ee4c770fb42f7fbbab76180"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"indexmap",
|
||||
"os_str_bytes",
|
||||
"strsim",
|
||||
"termcolor",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -160,6 +151,21 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.10.2"
|
||||
@ -337,9 +343,9 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
@ -367,14 +373,20 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
name = "termcolor"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
|
||||
dependencies = [
|
||||
"unicode-width",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.6"
|
||||
@ -384,24 +396,12 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.9.0+wasi-snapshot-preview1"
|
||||
@ -424,6 +424,15 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
|
@ -21,7 +21,7 @@ exclude = [
|
||||
travis-ci = { repository = "eqrion/cbindgen" }
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "2", optional = true }
|
||||
clap = { version = "3.1", optional = true }
|
||||
indexmap = "1"
|
||||
log = "0.4"
|
||||
serde = { version = "1.0.103", default-features = false, features = ["derive"]}
|
||||
|
56
src/main.rs
56
src/main.rs
@ -20,14 +20,14 @@ extern crate quote;
|
||||
extern crate syn;
|
||||
extern crate toml;
|
||||
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use clap::{Arg, ArgMatches, Command};
|
||||
|
||||
mod bindgen;
|
||||
mod logging;
|
||||
|
||||
use crate::bindgen::{Bindings, Builder, Cargo, Config, Error, Profile, Style};
|
||||
|
||||
fn apply_config_overrides<'a>(config: &mut Config, matches: &ArgMatches<'a>) {
|
||||
fn apply_config_overrides(config: &mut Config, matches: &ArgMatches) {
|
||||
// We allow specifying a language to override the config default. This is
|
||||
// used by compile-tests.
|
||||
if let Some(lang) = matches.value_of("lang") {
|
||||
@ -78,7 +78,7 @@ fn apply_config_overrides<'a>(config: &mut Config, matches: &ArgMatches<'a>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn load_bindings<'a>(input: &Path, matches: &ArgMatches<'a>) -> Result<Bindings, Error> {
|
||||
fn load_bindings(input: &Path, matches: &ArgMatches) -> Result<Bindings, Error> {
|
||||
// If a file is specified then we load it as a single source
|
||||
if !input.is_dir() {
|
||||
// Load any config specified or search in the input directory
|
||||
@ -130,62 +130,62 @@ fn load_bindings<'a>(input: &Path, matches: &ArgMatches<'a>) -> Result<Bindings,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let matches = App::new("cbindgen")
|
||||
let matches = Command::new("cbindgen")
|
||||
.version(bindgen::VERSION)
|
||||
.about("Generate C bindings for a Rust library")
|
||||
.arg(
|
||||
Arg::with_name("v")
|
||||
.short("v")
|
||||
.multiple(true)
|
||||
Arg::new("v")
|
||||
.short('v')
|
||||
.multiple_occurrences(true)
|
||||
.help("Enable verbose logging"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("verify")
|
||||
Arg::new("verify")
|
||||
.long("verify")
|
||||
.help("Generate bindings and compare it to the existing bindings file and error if they are different"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("config")
|
||||
.short("c")
|
||||
Arg::new("config")
|
||||
.short('c')
|
||||
.long("config")
|
||||
.value_name("PATH")
|
||||
.help("Specify path to a `cbindgen.toml` config to use"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("lang")
|
||||
.short("l")
|
||||
Arg::new("lang")
|
||||
.short('l')
|
||||
.long("lang")
|
||||
.value_name("LANGUAGE")
|
||||
.help("Specify the language to output bindings in")
|
||||
.possible_values(&["c++", "C++", "c", "C", "cython", "Cython"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("cpp-compat")
|
||||
Arg::new("cpp-compat")
|
||||
.long("cpp-compat")
|
||||
.help("Whether to add C++ compatibility to generated C bindings")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("only-target-dependencies")
|
||||
Arg::new("only-target-dependencies")
|
||||
.long("only-target-dependencies")
|
||||
.help("Only fetch dependencies needed by the target platform. \
|
||||
The target platform defaults to the host platform; set TARGET to override.")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("style")
|
||||
.short("s")
|
||||
Arg::new("style")
|
||||
.short('s')
|
||||
.long("style")
|
||||
.value_name("STYLE")
|
||||
.help("Specify the declaration style to use for bindings")
|
||||
.possible_values(&["Both", "both", "Tag", "tag", "Type", "type"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("d")
|
||||
.short("d")
|
||||
Arg::new("d")
|
||||
.short('d')
|
||||
.long("parse-dependencies")
|
||||
.help("Whether to parse dependencies when generating bindings"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("clean")
|
||||
Arg::new("clean")
|
||||
.long("clean")
|
||||
.help(
|
||||
"Whether to use a new temporary directory for expanding macros. \
|
||||
@ -193,7 +193,7 @@ fn main() {
|
||||
.required(false)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("INPUT")
|
||||
Arg::new("INPUT")
|
||||
.help(
|
||||
"A crate directory or source file to generate bindings for. \
|
||||
In general this is the folder where the Cargo.toml file of \
|
||||
@ -202,7 +202,7 @@ fn main() {
|
||||
.index(1),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("crate")
|
||||
Arg::new("crate")
|
||||
.long("crate")
|
||||
.value_name("CRATE_NAME")
|
||||
.help(
|
||||
@ -212,15 +212,15 @@ fn main() {
|
||||
.required(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("out")
|
||||
.short("o")
|
||||
Arg::new("out")
|
||||
.short('o')
|
||||
.long("output")
|
||||
.value_name("PATH")
|
||||
.help("The file to output the bindings to")
|
||||
.required(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("lockfile")
|
||||
Arg::new("lockfile")
|
||||
.long("lockfile")
|
||||
.value_name("PATH")
|
||||
.help(
|
||||
@ -231,7 +231,7 @@ fn main() {
|
||||
.required(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("metadata")
|
||||
Arg::new("metadata")
|
||||
.long("metadata")
|
||||
.value_name("PATH")
|
||||
.help(
|
||||
@ -246,7 +246,7 @@ fn main() {
|
||||
.required(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("profile")
|
||||
Arg::new("profile")
|
||||
.long("profile")
|
||||
.value_name("PROFILE")
|
||||
.help(
|
||||
@ -256,8 +256,8 @@ fn main() {
|
||||
.possible_values(&["Debug", "debug", "Release", "release"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("quiet")
|
||||
.short("q")
|
||||
Arg::new("quiet")
|
||||
.short('q')
|
||||
.long("quiet")
|
||||
.help("Report errors only (overrides verbosity options).")
|
||||
.required(false),
|
||||
|
Loading…
x
Reference in New Issue
Block a user