examples/numeric_prefix.rs

```no_run
/// You can parse multiple positional elements with earlier being optional as well
/// This example takes two - optional numeric prefix and a command name:
///
/// > numeric_prefix 8 work
/// Options { prefix: Some(8), command: "work" }
///
/// > numeric_prefix sleep
/// Options { prefix: None, command: "sleep" }
///
/// Generated usage reflects that:
/// Usage: numeric_prefix [PREFIX] COMMAND
use bpaf::*;

#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct Options {
    prefix: Option<usize>,
    command: String,
}

pub fn options() -> OptionParser<Options> {
    let prefix = positional::<usize>("PREFIX")
        .help("Optional numeric command prefix")
        .optional()
        .catch();
    let command = positional::<String>("COMMAND").help("Required command name");

    construct!(Options { prefix, command }).to_options()
}

fn main() {
    println!("{:#?}", options().run());
}

```


Output

If `bpaf` can parse first positional argument as number - it becomes a numeric prefix

$ app 10 eat
Options { prefix: Some(10), command: "eat" }

Otherwise it gets ignored

$ app "just eat"
Options { prefix: None, command: "just eat" }

If validation passes but second argument is missing - in this example there's no fallback

$ app 10
Error: expected COMMAND, pass --help for usage information

Help should show that the prefix is optional

$ app --help

Usage: app [PREFIX] COMMAND

Available positional items:

PREFIX

Optional numeric command prefix

COMMAND

Required command name

Available options:

-h, --help

Prints help information

