Skip to content

Commit

Permalink
fix: Handle case when no installed packages are found
Browse files Browse the repository at this point in the history
  • Loading branch information
mischah committed Mar 1, 2019
1 parent c09aa5e commit 20134d4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ibrew/lib/installed.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ module.exports.selectPackage = async options => {

spinner.start(`Retrieving ${scope} packages`);
const installedPackages = await getInstalledPackages(outdatedOnly);
const choices = installedPackages.split('\n');
spinner.succeed(`Found ${choices.length} ${scope} packages`);
const choices = installedPackages.length
? installedPackages.split('\n')
: null;
if (!choices) {
spinner.fail(`Found no ${scope} package(s)`);
process.exit(0);
}

spinner.succeed(`Found ${choices.length} ${scope} package(s)`);
const selected = await inquirer.prompt([
{
type: 'checkbox',
Expand Down

0 comments on commit 20134d4

Please sign in to comment.