Home

Awesome

pico-args

Build Status Crates.io Documentation Rust 1.32+

An ultra simple CLI arguments parser.

If you think that this library doesn't support some feature, it's probably intentional.

Build features

Limitations

The main fundamental limitation of pico-args is that it parses arguments in an arbitrary order. This is because we have a sort of "streaming" API and we don't know all the keys/arguments beforehand. This could lead to some unexpected behaviors. Specifically, let's say you have a following arguments:

--arg1 --arg2 value

If your parser tries to parse --arg1 as key-value first, than its value would be --arg2 and not value, because the parser simply takes the "next" argument. A properer parser would knew that --arg2 is a key and will return an error, since the value is missing.

If your parser tries to parse --arg2 as a flag first and then --arg1 as key-value, then its value would be value, because --arg2 was already removed by the parser and the arguments list looks like --arg1 value to the parser.

If such behavior is unacceptable to your application, then you have to use a more high-level arguments parsing library.

Alternatives

The core idea of pico-args is to provide some "sugar" for arguments parsing without a lot of overhead (binary or compilation time wise). There are no point in comparing parsing features since pico-args supports only the bare minimum. Here is a great comparison of various arguments parsing libraries.

License

MIT