Skip to content

Commit

Permalink
Don't try interactive install with empty package list
Browse files Browse the repository at this point in the history
  • Loading branch information
Morganamilo committed Nov 28, 2023
1 parent f9a6917 commit 26ce55f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ async fn handle_sync(config: &mut Config) -> Result<i32> {
} else {
if config.interactive {
search::interactive_search(config, true).await?;
if config.targets.is_empty() {
return Ok(1);
}
}
let target = std::mem::take(&mut config.targets);
install::install(config, &target).await?;
Expand Down
8 changes: 6 additions & 2 deletions src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,10 @@ pub fn interactive_search_local(config: &mut Config) -> Result<()> {
for pkg in repo_pkgs {
all_pkgs.push(AnyPkg::RepoPkg(pkg));
}

let was_results = all_pkgs.is_empty();
let targs = interactive_menu(config, all_pkgs, false)?;
if targs.is_empty() {
if targs.is_empty() && !was_results {
printtr!(" there is nothing to do");
}
config.targets = targs.clone();
Expand All @@ -428,8 +430,9 @@ pub async fn interactive_search(config: &mut Config, install: bool) -> Result<()
all_pkgs.push(AnyPkg::AurPkg(pkg));
}

let was_results = all_pkgs.is_empty();
let targs = interactive_menu(config, all_pkgs, install)?;
if targs.is_empty() {
if targs.is_empty() && !was_results {
printtr!(" there is nothing to do");
}
config.targets = targs.clone();
Expand All @@ -446,6 +449,7 @@ pub fn interactive_menu(

if all_pkgs.is_empty() {
printtr!("no packages match search");
return Ok(Vec::new());
}

let indexes = all_pkgs
Expand Down

0 comments on commit 26ce55f

Please sign in to comment.