4 ms·
Most languages have terrible CLI parsing support, I have yet to find something built in that matches Python’s argparse module. Hell, even “modern” languages lik
by vultour 6y ago
Most languages have terrible CLI parsing support, I have yet to find something built in that matches Python’s argparse module. Hell, even “modern” languages like go suffer from this.
- ibraheemdev 6y agoPython’s success is at least partially due to its “batteries included” methodology, but many of its standard modules didn’t get any support because external solutions just turned out to be better. Rust maintains a small but high quality standard library in part to avoid the problems that Python's standard library fell into. Things like cli parsers can be downloaded easily using cargo's amazing tooling. We get packages like structopt for example, which provides a custom derive parsing command line arguments: #[derive(StructOpt)] struct Opt { #[structopt(short, long)] debug: bool, #[structopt(short = "c", long)] nb_cars: Option<i32>, #[structopt(short, long)] level: Vec<String>, }
- masklinn 6y agoIMO structopt is way superior to argparse (which is itself not very good, it works to avoid a dependency but if I already have dependencies I'd rather use click).