From 56a4f62e911816f0a33242d458acbe446c5cf6b9 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Fri, 15 Jun 2018 14:05:05 -0700 Subject: [PATCH] fix: add aliases --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 4773e935..cd44cc01 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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))!