Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 515 Bytes

custom-js-completion.md

File metadata and controls

34 lines (26 loc) · 515 Bytes

Example: custom completion returned by js module

js-completion.yml

commands:
  - name: js-completion
    description: prints hello world
    command: echo "hello world"
    completion:
      completionPath: ./completion.js

completion.js

module.exports = function () {
  return ['a', 'b', 'c'];
};

Usage

nca js-completion {tab}

Prints:

a b c

Notes:

Adding the flag merge: true in the completion, merges the custom completion with the default yargs one.