-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support allow_hyphen_values #41
Comments
On mobile, but I'll try to explain. Use the Does it fixes your issue ? |
Side note: timezone can be half and quarter of an hour. Look at India :'-( |
In case someone else stumbles upon this, you can go: #[derive(StructOpt)]
#[structopt(name = "app"))]
struct Opt {
// ...
// Pass the rest of the arguments through
#[structopt(raw(allow_hyphen_values = "true"))]
rest_of_args: Vec<String>,
} The command needs to be invoked like so: # the '--' separator is important
$ app -- rest_of_args_1 --rest_of_args_option |
It was not working here because I was deriving |
Raw is no more a thing in 0.3 |
|
@PvdBerg1998 please provide a more comprehensive example, that compiles, with a call explaining what you have, and what you're expecting. Also, adding a comment in a closed issue might not be noticed. |
I'm expecting the argument to get parsed with a hyphen in front, e.g. "-20". I've found out this works with a negative x or y: #[derive(Clone, Debug, PartialEq, Eq, StructOpt)]
#[structopt(setting = structopt::clap::AppSettings::AllowLeadingHyphen)]
struct Args {
x: String,
y: String
} But this does not, although it does compile like I said: #[derive(Clone, Debug, PartialEq, Eq, StructOpt)]
struct Args {
#[structopt(allow_hyphen_values(true))]
x: String,
#[structopt(allow_hyphen_values(true))]
y: String
} |
I'm having the same issue #[structopt(default_value = "0", allow_hyphen_values = true)]
date: Vec<String>, Also when I tried @PvdBerg1998 solution it gives me an error saying setting I get no named method. I'm trying to pass cc @TeXitoi edit: Okay this |
Currently, providing a negative value for an integer parameter results in an error about an unexpected argument. It would be nice if
structopt
supportedclap
'sallow_hyphen_values
option.structopt
actually seems to, but only on Nightly, since you have to do...and that literal
true
value requires#![feature(attr_literals)]
to work currently.The text was updated successfully, but these errors were encountered: