Closed Milo123459 closed 3 years ago
use std::path::PathBuf;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Opt {
#[structopt(
parse(from_os_str),
default_value = ".glitterrc",
long,
visible_alias = "rc"
)]
conf: PathBuf,
}
fn main() {
println!("{:?}", Opt::from_args());
}
cargo run --manifest-path /home/gpinot/dev/test-rs/Cargo.toml -- --help
Blocking waiting for file lock on build directory
Compiling test-rs v0.1.0 (/home/gpinot/dev/test-rs)
Finished dev [unoptimized + debuginfo] target(s) in 0.60s
Running `target/debug/test-rs --help`
test-rs 0.1.0
USAGE:
test-rs [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--conf <conf> [default: .glitterrc] [aliases: rc]
Works here. Please provide a complete example.
In the help command, I don't see it.
Nevermind, I had to rebuild.
^ This is my code.
When typing cargo run -- --help the alias doesn't appear there.
Is there a fix or am I doing it wrong?