Fix error reporting in main and move all arg validation into fn args::parse (#585)

* Fix reporting parsing error from `args::parse`
   Report it in `args::parse` by using `Args::command().error(...).exit()`
   instead of returning `BinstallError`.
* Rm unused variant `BinstallError::OverrideOptionUsedWithMultiInstall`
* Refactor: Move `strategies` validation into `args::parse`
* Rm unused variant `BinstallError::InvalidStrategies`
* Add new unit test `args::test::verify_cli`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-12-03 22:57:50 +11:00 committed by GitHub
parent b564b8ac4e
commit a69db83aa6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 114 additions and 122 deletions

View file

@ -18,10 +18,7 @@ fn main() -> MainExit {
// This must be the very first thing to happen
let jobserver_client = LazyJobserverClient::new();
let args = match args::parse() {
Ok(args) => args,
Err(err) => return MainExit::Error(err),
};
let args = args::parse();
if args.version {
println!("{}", env!("CARGO_PKG_VERSION"));