4 ms·
There is no "built-in" command line parser in Rust. All it has is std::env::args (https://doc.rust-lang.org/std/env/fn.args.html https://doc.rust-lang.org/std/e
by cesarb 5y ago
There is no "built-in" command line parser in Rust. All it has is std::env::args (https://doc.rust-lang.org/std/env/fn.args.html https://doc.rust-lang.org/std/env/fn.args.html) and std::env::args_os (https://doc.rust-lang.org/std/env/fn.args_os.html https://doc.rust-lang.org/std/env/fn.args_os.html), which give you the raw command line. Rust does not follow the "batteries included" philosophy for its base standard library, to avoid "leaking batteries" problems like seen for instance with Python (https://news.ycombinator.com/item?id=19948642 https://news.ycombinator.com/item?id=19948642).
- alain_gilbert 5y agoI know there is no flag library built-in in rust (I do quite a lot of rust as well as go). That's my whole point. It should be compared to something like https://github.com/urfave/cli https://github.com/urfave/cli . That would be a fairer comparison.
- dmart 5y agoSure, for example I usually use Cobra. But what I meant was that people often mention Go as being explicitly preferable to Rust for CLIs, and I’m not sure why if I have to pull in a dependency in either case.