Skip to content

Commit

Permalink
Error out when no version is specified in tree-of
Browse files Browse the repository at this point in the history
  • Loading branch information
ammernico committed Aug 1, 2023
1 parent 759fab1 commit 0097cd8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/commands/tree_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,20 @@ pub async fn tree_of(matches: &ArgMatches, repo: Repository) -> Result<()> {
.get_one::<String>("package_name")
.map(|s| s.to_owned())
.map(PackageName::from);
let pvers = matches
.get_one::<String>("package_version")

let pvers = matches.get_one::<String>("package_version");

match pvers {
Some(v) => {
trace!("Called with version: {}", v);
},
_ => {
error!("Please specify a version of package with: packagename =version");
std::process::exit(1);
},
};

let pvers = pvers
.map(|s| s.to_owned())
.map(PackageVersionConstraint::try_from)
.transpose()?;
Expand Down

0 comments on commit 0097cd8

Please sign in to comment.