Skip to content

Clap application with subcommand configuration, allowing for constructing a default configuration file. #5794

Closed Answered by epage
Eclextic asked this question in Q&A
Discussion options

You must be logged in to vote

You had

    #[arg(long, action = ArgAction::Set, default_missing_value = "false", required = false, verbatim_doc_comment)]
    pub exit_on_close: Option<bool>,
  • default_missing_value says what to fill in if the flag is seen but no value follows
  • num_args says how many values can follow it

So what you probably want is

    #[arg(long, num_args=0, default_missing_value = "true", verbatim_doc_comment)]
    pub exit_on_close: Option<bool>,

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@Eclextic
Comment options

@epage
Comment options

@Eclextic
Comment options

@Eclextic
Comment options

Answer selected by Eclextic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants