-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4dcfce
commit d564a36
Showing
2 changed files
with
58 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
use clap::Parser; | ||
use colored::Colorize; | ||
|
||
mod cli; | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
fn main() { | ||
let cli = cli::Cli::parse(); | ||
|
||
let res = match cli.command { | ||
Some(cli::Commands::List { | ||
package, | ||
raw, | ||
no_color, | ||
}) => cli::list(&package, raw, no_color), | ||
}) => cli::list(package, raw, no_color), | ||
Some(cli::Commands::Downgrade { package, version }) => cli::downgrade(package, version), | ||
None => panic!(), | ||
}; | ||
|
||
match res { | ||
Ok(s) => print!("{s}"), | ||
Err(e) => return Err(e), | ||
Err(e) => { | ||
eprint!("{}: {e}", "Error".red()); | ||
std::process::exit(1); | ||
} | ||
}; | ||
|
||
Ok(()) | ||
} |