build(ariadne): vendor clap
This commit was merged in pull request #30.
This commit is contained in:
29
third_party/crates/clap-4.6.6/examples/cargo-example.rs
vendored
Normal file
29
third_party/crates/clap-4.6.6/examples/cargo-example.rs
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
fn main() {
|
||||
let cmd = clap::Command::new("cargo")
|
||||
.bin_name("cargo")
|
||||
.styles(CLAP_STYLING)
|
||||
.subcommand_required(true)
|
||||
.subcommand(
|
||||
clap::command!("example").arg(
|
||||
clap::arg!(--"manifest-path" <PATH>)
|
||||
.value_parser(clap::value_parser!(std::path::PathBuf)),
|
||||
),
|
||||
);
|
||||
let matches = cmd.get_matches();
|
||||
let matches = match matches.subcommand() {
|
||||
Some(("example", matches)) => matches,
|
||||
_ => unreachable!("clap should ensure we don't get here"),
|
||||
};
|
||||
let manifest_path = matches.get_one::<std::path::PathBuf>("manifest-path");
|
||||
println!("{manifest_path:?}");
|
||||
}
|
||||
|
||||
// See also `clap_cargo::style::CLAP_STYLING`
|
||||
pub const CLAP_STYLING: clap::builder::styling::Styles = clap::builder::styling::Styles::styled()
|
||||
.header(clap_cargo::style::HEADER)
|
||||
.usage(clap_cargo::style::USAGE)
|
||||
.literal(clap_cargo::style::LITERAL)
|
||||
.placeholder(clap_cargo::style::PLACEHOLDER)
|
||||
.error(clap_cargo::style::ERROR)
|
||||
.valid(clap_cargo::style::VALID)
|
||||
.invalid(clap_cargo::style::INVALID);
|
||||
Reference in New Issue
Block a user