Constant ap::UNKNOWN_OPTION_HANDLER_OPT[][src]

pub const UNKNOWN_OPTION_HANDLER_OPT: char = '?';
Expand description

Special value that if registered as an Arg will pass all unknown options to the handler to all it to deal with them. When the handler is called in this scenario, [Arg.option] will be set to UNKNOWN_OPTION_HANDLER_OPT.

Notes

  • Similar to Settings::ignore_unknown_options, but whereas that option will entirely ignore unknown options, this feature will redirect unknown options to your handler for processing.
  • You probably don’t want to have to deal with this. But if you are sure, read on…
  • Since the option is not registered, the option is treated as a flag. To handle unknown “normal options” with an argument, you would need to register an Arg for POSITIONAL_HANDLER_OPT too. It would then be up to your handler to decide if the unknown option was a “normal option”, or a flag. If it was a normal option, the handler would need to save some state and look at the next argument provided to the handler which, assuming it is a non-option would be either the unknown option’s argument, or a positional argument.