0.0.6 • Published 5 years ago
@kli-tool/searcher v0.0.6
KLI Command Searcher
Accepts an array of commands with a name and aliases, then returns a searcher that can be used to autcomplete and detect which command was intended.
    it('ensure searching for all aliases and names are the same', assert => {
        const subject = searcher({
            commands: [
                {
                    name: 'command',
                    aliases: ['test', 'another'],
                },
            ],
        })
        const name = subject.get('comm')[0]
        const alias1 = subject.get('test')[0]
        const alias2 = subject.get('anot')[0]
        assert.ok(name === alias1 && alias1 === alias2 && alias2 === name)
    })