For example, running my application with
./app --foo=bar get
works well, but
./app get --foo=bar
Produces an error:
error: Found argument '--foo' which wasn't expected, or isn't valid in this context
USAGE:
app --foo <foo> get
Code:
use structopt::*;
#[derive(Debug, StructOpt)]
#[structopt(name = "app")]
struct CliArgs {
#[structopt(long)]
foo: String,
#[structopt(subcommand)]
cmd: Cmd,
}
#[derive(Debug, StructOpt)]
enum Cmd {
Get,
Set,
}
fn main() {
let args = CliArgs::from_args();
println!("{:?}", args);
}
Dependencies:
structopt = { version = "0.3", features = [ "paw" ] }
paw = "1.0"