diff --git a/lib/commands/autocomplete/helper.js b/lib/commands/autocomplete/helper.js index 07c33f71..8f0f072b 100644 --- a/lib/commands/autocomplete/helper.js +++ b/lib/commands/autocomplete/helper.js @@ -1,19 +1,17 @@ const fs = require('fs-extra'); +const path = require('path'); module.exports = class Helper { constructor(omelette, commanders = []) { this.commanders = commanders; this.completion = omelette('ask'); - this.autoCompleteHintsFile = 'autocomplete-hints.json'; + this.autoCompleteHintsFile = path.join(__dirname, 'autocomplete-hints.json'); } _getAutoCompleteOptions() { const options = {}; this.commanders.forEach(com => { - options[com.name()] = []; - com.commands.forEach(sumCom => { - options[com.name()].push(sumCom.name()); - }); + options[com.name()] = com.commands.map(sumCom => sumCom.name()); }); return options;