Skip to content

Commit

Permalink
fix: add aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jun 15, 2018
1 parent 3c47176 commit 56a4f62
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
Expand Up @@ -5,7 +5,11 @@ import * as Levenshtein from 'fast-levenshtein'
import * as _ from 'lodash'

const hook: Hook<'command_not_found'> = async function (opts) {
const commandIDs = opts.config.commandIDs
const commandIDs = [
...opts.config.commandIDs,
..._.flatten(opts.config.commands.map(c => c.aliases)),
'version',
]
if (!commandIDs.length) return
function closest(cmd: string) {
return _.minBy(commandIDs, c => Levenshtein.get(cmd, c))!
Expand Down

0 comments on commit 56a4f62

Please sign in to comment.