You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if the library contained this function:
/// Fallible version of argh::from_env().
pub fn try_from_env<T: argh::TopLevelCommand>() -> std::result::Result<T, argh::EarlyExit> {
let strings: Vec<String> = std::env::args().collect();
let cmd = cmd(&strings[0], &strings[0]);
let strs: Vec<&str> = strings.iter().map(|s| s.as_str()).collect();
T::from_args(&[cmd], &strs[1..])
}
Use case is a bit niche - it's a command that is run with no stdout or stderr so the only way I can see CLI errors is to write them to a file, and I can't do that with argh::from_env().
Also seems a bit weird that argh::EarlyExit uses Result<(), ()> and String rather than just being Result<(), String>.
The text was updated successfully, but these errors were encountered:
It would be nice if the library contained this function:
Use case is a bit niche - it's a command that is run with no stdout or stderr so the only way I can see CLI errors is to write them to a file, and I can't do that with
argh::from_env()
.Also seems a bit weird that
argh::EarlyExit
usesResult<(), ()>
andString
rather than just beingResult<(), String>
.The text was updated successfully, but these errors were encountered: