Skip to content

Instantly share code, notes, and snippets.

@palfrey
Last active February 29, 2020 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palfrey/9b7a44938b64550f53da6a3fe806ba2e to your computer and use it in GitHub Desktop.
Save palfrey/9b7a44938b64550f53da6a3fe806ba2e to your computer and use it in GitHub Desktop.
Demo for structopt possible_values issue
[package]
name = "structopt-bug"
version = "0.1.0"
authors = ["Tom Parker-Shemilt <palfrey@tevp.net>"]
edition = "2018"
[dependencies]
# This works
# structopt = "=0.3.7"
# This doesn't work
structopt = "=0.3.8"
# Fix for https://github.com/TeXitoi/structopt/pull/353
syn = { version = "1", default-features = false, features = ["derive", "parsing", "proc-macro", "clone-impls"] }
use structopt::StructOpt;
#[derive(Debug, StructOpt, Clone)]
struct Args {
#[structopt(
short = "c",
long = "colour",
help = "Output colouring",
default_value = "auto",
possible_values = &["always", "auto", "never"]
)]
colour: String,
}
fn main() {
let _ = Args::from_args();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment