parasyte / onlyargs

Only argument parsing! Nothing more.
MIT License
13 stars 2 forks source link

Support multi-value arguments by collecting into a Vec #33

Closed parasyte closed 4 months ago

parasyte commented 5 months ago

As of now, Vec is reserved for positional arguments, but I want to change that limitation to allow Vec to collect multi-value args. For instance, I have a use case where I want zero or more paths to be specified, like this:

$ cli --input-path ./foo/bar --input-path ./baz --input-path /tmp/hello.txt

... which will parse to:

struct Args {
    input_path: Vec<PathBuf>,
}
// dbg!(args);
args = Args {
    input_path: ["./foo/bar", "./baz", "/tmp/hello.txt"],
}

To do this, I will probably change positional args to require a new attribute on a Vec. This is a breaking change.