pico-args
An ultra simple CLI arguments parser.
- Only flags, options and free arguments are supported.
- Arguments can be separated by a space or
=. - Non UTF-8 arguments are supported.
- No help generation.
- No combined flags (like
-vvv,-abcor-j1). - Arguments are parsed in a linear order. From first to last.
Example
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. So we will compare only the size overhead and compilation time.
There are a lot of arguments parsing implementations, but we will use only these one:
- clap - is the most popular and complete one
- gumdrop - a simple parser that uses procedural macros
- structopt - a two above combined
pico-args |
clap |
gumdrop |
structopt |
|
|---|---|---|---|---|
| Binary overhead | 20.0KiB | 435.1KiB | 23.0KiB | 436.8KiB |
| Build time | 1s | 15s | 31s | 27s |
| Tested version | 0.3.0 | 2.33.0 | 0.6.0 | 0.2.18 |
- Binary size overhead was measured by subtracting the
.textsection size of an app with arguments parsing and a hello world app. - Build time was measured using
hyperfine 'cargo clean; cargo build --release'. - Test projects can be found in
test-apps/.
License
MIT