Vorpal version 1 autocomplete problem
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 278
- PR merge metrics
- No merged PRs in 30d
Description
I created this video demonstrating the problem
https://www.useloom.com/share/40a9509bf03248d586d0357894f0edf4
I would like to use tab completion to access a directory
something like this:
`node test/src/dev/node/foo.test.js`
but using Vorpals autocomplete functionality does not make tab completing through a filesystem easy at all because Vorpal adds an extra character after the user hits tab. See the video.
My code to do the autocompletion looks like this:
```js
vorpal.command('run [file]')
.description('run a single test script')
.autocomplete({
data: function (input: string, cb: Function) {
const basename = path.basename(input);
const dir = path.dirname(path.resolve(process.cwd() + `/${input}`));
fs.readdir(dir, function (err, items) {
if (err) {
return cb(null);
}
const matches = items.filter(function (item) {
return String(item).match(basename);
});
return cb(matches);
});
}
})
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.