An extension to Vorpal that provides File System-based tabbed autocompletion for a given command. This is an exact match of the autocomplete functionality provided in Unix commands like ls
or cat
.
npm install vorpal-autocomplete-fs
npm install vorpal
const vorpal = require('vorpal')();
const fsAutocomplete = require('vorpal-autocomplete-fs');
vorpal.delimiter('myapp$').show();
vorpal
.command('cat [dirs...]')
.autocomplete(fsAutocomplete());
$ node myapp.js
myapp$ cat [tab] [tab]
bin/ myapp.js package.json README.md
myapp~$ cat m [tab]
myapp~$ cat myapp.js
To omit files from the autocomplete and only show directories, pass in the directory
option:
vorpal
.command('cat [dirs...]')
.autocomplete(fsAutocomplete({directory: true}));
MIT © David Caccavella