Skip to content

Commit

Permalink
make it able to clear entries
Browse files Browse the repository at this point in the history
  • Loading branch information
sdras committed Jul 3, 2021
1 parent 98b87a4 commit 2547105
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/clearLookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ inquirer.prompt(clearQuestion).then((answer) => {
store.clear()
}

console.log(chalk.cyan('jsexplorer ' + figures.arrowRight) + ' entries all cleared!')
console.log(chalk.cyan('\njsexplorer ' + figures.arrowRight) + ' entries all cleared!\n')
})
16 changes: 14 additions & 2 deletions bin/lookup.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env node

'use strict'
import { store } from './store.js'
import chalk from 'chalk'
import minimist from 'minimist'

import { store } from './store.js'
import { logFinalAnswer } from './logFinalAnswer.js'

// gather the name as argument parameters and turn it into a string
Expand All @@ -11,4 +13,14 @@ const argv = minimist(args);
let finalArgv = argv._.join(" ")

// look up the answer in the store
logFinalAnswer(store.get(finalArgv))
if (store.get(finalArgv)) {
logFinalAnswer(store.get(finalArgv))
} else {
console.log(chalk.redBright(`\nSorry!`) + `
We can't quite find what you're looking for.
Perhaps run ${chalk.cyanBright('jsexplorer')} again and make sure you've stored it appropriately?
You can also look up commands by typing ${chalk.cyanBright('man explorer')}\n`)
}


0 comments on commit 2547105

Please sign in to comment.