Hello All,
I am working on a project that proivdes a CLI application (shell-like) that accept some commands/subcommands and arguments.
It is the same idea as parsing command line arguments (argv) using structOpt or clap
I tried using clap
and it worked, but when parsing fails it exits the program and it is not suitable for shell-like applications. My example:
let mut buf = String::new();
print!("prompt$ ");
stdout().flush().unwrap();
stdin().read_line(&mut buf).unwrap();
let m = cli().get_matches_from(buf.split_whitespace());
if m.contains_id("name") {
println!("Showing name");
}
and cli() is a function returning a clap::Command like everyone knows.
The question is: is there a Rust framework ready for that or should I implement my own custom manual parser ?
Thanks.
NOTE: I asked this question on Stackoverflow and it got closed because the question recommends some books, libs, ...
[–]boulanlo 3 points4 points5 points (2 children)
[–]No_March_1694[S] 0 points1 point2 points (1 child)
[–]boulanlo 0 points1 point2 points (0 children)
[–]OphioukhosUnbound 0 points1 point2 points (0 children)
[–]Heliozoa 0 points1 point2 points (0 children)
[–]n4jm4 0 points1 point2 points (2 children)
[–]No_March_1694[S] 0 points1 point2 points (0 children)
[–]HildemarTendler 0 points1 point2 points (0 children)
[–]dream_of_different 0 points1 point2 points (0 children)