-
Hey! I have a following code: #[derive(Parser)]
struct Args {
#[clap(subcommand)]
cmd: Command,
}
#[derive(Subcommand)]
enum Command {
/// Generate a maze.
Generate {
/// Maze width.
#[clap(short, long, default_value = "10")]
width: usize,
/// Maze height.
#[clap(short, long, default_value = "10")]
height: usize,
/// Print ASCII representation to stdout.
#[clap(short, long)]
print_ascii: bool,
/// Save ASCII representation to a file.
#[clap(short = 'a', long)]
save_ascii: Option<PathBuf>,
/// Save JPEG representation to a file.
#[clap(short = 'j', long)]
save_jpeg: Option<PathBuf>,
},
} The argument |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I don't think we have a way to unset the short flag on help but if you define your own help flag, we'll automatically do the help action for it and you can leave off the short. |
Beta Was this translation helpful? Give feedback.
-
Is there a way to keep |
Beta Was this translation helpful? Give feedback.
-
The above changes didn't allow me to use #[derive(Debug, Args)]
#[clap(disable_help_flag = true)]
pub struct PlayArgs {
#[clap(long, action = clap::ArgAction::HelpLong)]
help: Option<bool>,
#[clap(short, long)]
hidden: bool,
} |
Beta Was this translation helpful? Give feedback.
I don't think we have a way to unset the short flag on help but if you define your own help flag, we'll automatically do the help action for it and you can leave off the short.