{"repo":"blyxxyz/lexopt","free":true,"listed":false,"github":"https://github.com/blyxxyz/lexopt","clone":"git clone https://github.com/blyxxyz/lexopt.git","description":"Minimalist pedantic command line parser","language":"Rust","stars":414,"topics":["argument-parser","command-line","getopt","rust"],"license":"MIT","category":"cli-tools","readme_excerpt":"Lexopt Lexopt is an argument parser for Rust. It tries to have the simplest possible design that's still correct. It's so simple that it's a bit tedious to use. Lexopt is: - Small: one file, no dependencies, no macros. Easy to audit or vendor. - Correct: standard conventions are supported and ambiguity is avoided. Tested and fuzzed. - Pedantic: arguments are returned as OsString s, forcing you to convert them explicitly. This lets you handle badly-encoded filenames. - Imperative: options are returned as they are found, nothing is declared ahead of time. - Minimalist: only basic functionality is provided. - Unhelpful: there is no help generation and error messages often lack context. Example Let's walk through this: - We start parsing with Parser::from env() . - We call parser.next() in a loop to get all the arguments until they run out. - We match on arguments. Short and Long indicate an option. - To get the value that belongs to an option (like 10 in -n 10 ) we call parser.value() . - This returns a standard OsString . - For convenience, use lexopt::prelude:: adds a .parse() method, analogous to the one on &str . - Calling parser.value() is how we tell Parser that -n takes a value at all. - Value indicates a free-standing argument. - if thing.is none() is a useful pattern for positional arguments. If we already found thing we pass it on to another case. - It also contains an OsString . - The .string() method decodes it into a plain String . - If we don't know what to do with","default_branch":null,"files":null,"tree":[],"storefront":"/r/blyxxyz","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/blyxxyz/lexopt/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}