top | item 38735284 (no title) llagerlof | 2 years ago What are the methods available?--method <METHOD> The initialisation method to use discuss order hn newest joshbuckler|2 years ago Looks like "braid", "clear", "branching", or "winding" https://github.com/moses-palmer/labyru/blob/master/maze/src/... moses-palmer|2 years ago Yeah, I was hoping the `clap` macros would perform some unthinkable magic there... I will have to update the help with a listing.In the mean time, have a look here[1] for the possible values.[1]: https://github.com/moses-palmer/labyru/blob/7b92be3ae279a9ff... linkdd|2 years ago `clap` does have magic for enums: use clap::{Parser, ValueEnum}; #[derive(ValueEnum, Debug, Clone)] pub enum Foo { Bar, Baz, } #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] pub struct Args { /// description #[arg(short = 'f', long = "foo", value_enum, default_value = "bar")] foo: Foo, } The output of `--help` will look like: -f, --foo <FOO> description [default: bar] [possible values: bar, baz] This is with clap >= 4.4 with the derive feature.
joshbuckler|2 years ago Looks like "braid", "clear", "branching", or "winding" https://github.com/moses-palmer/labyru/blob/master/maze/src/...
moses-palmer|2 years ago Yeah, I was hoping the `clap` macros would perform some unthinkable magic there... I will have to update the help with a listing.In the mean time, have a look here[1] for the possible values.[1]: https://github.com/moses-palmer/labyru/blob/7b92be3ae279a9ff... linkdd|2 years ago `clap` does have magic for enums: use clap::{Parser, ValueEnum}; #[derive(ValueEnum, Debug, Clone)] pub enum Foo { Bar, Baz, } #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] pub struct Args { /// description #[arg(short = 'f', long = "foo", value_enum, default_value = "bar")] foo: Foo, } The output of `--help` will look like: -f, --foo <FOO> description [default: bar] [possible values: bar, baz] This is with clap >= 4.4 with the derive feature.
linkdd|2 years ago `clap` does have magic for enums: use clap::{Parser, ValueEnum}; #[derive(ValueEnum, Debug, Clone)] pub enum Foo { Bar, Baz, } #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] pub struct Args { /// description #[arg(short = 'f', long = "foo", value_enum, default_value = "bar")] foo: Foo, } The output of `--help` will look like: -f, --foo <FOO> description [default: bar] [possible values: bar, baz] This is with clap >= 4.4 with the derive feature.
joshbuckler|2 years ago
moses-palmer|2 years ago
In the mean time, have a look here[1] for the possible values.
[1]: https://github.com/moses-palmer/labyru/blob/7b92be3ae279a9ff...
linkdd|2 years ago