Add the following files in a new folder (with paths as per filenames), and comment/uncomment the structopt dependencies to demo it. This is derived from code at https://github.com/Michael-F-Bryan/mdbook-linkcheck
Last active
February 29, 2020 23:24
-
-
Save palfrey/9b7a44938b64550f53da6a3fe806ba2e to your computer and use it in GitHub Desktop.
Demo for structopt possible_values issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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