UNPKG

cli-engine

Version:
50 lines (39 loc) 1.69 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _path = require('path'); var _path2 = _interopRequireDefault(_path); var _ = require('.'); var _2 = _interopRequireDefault(_); var _autocomplete = require('../../autocomplete'); var _autocomplete2 = _interopRequireDefault(_autocomplete); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } class AutocompleteScript extends _2.default { // hide until beta release async run() { this.errorIfWindows(); const ac = new _autocomplete2.default(this); await ac.createCaches(); const shell = this.argv[0] || this.config.shell; if (!shell) { this.out.error('Error: Missing required argument shell'); } switch (shell) { case 'zsh': this.out.log(`HEROKU_ZSH_AC_SETUP_PATH=${_path2.default.join(this.completionsPath, 'zsh_setup')} && test -f $HEROKU_ZSH_AC_SETUP_PATH && source $HEROKU_ZSH_AC_SETUP_PATH;`); break; case 'bash': this.out.log(`HEROKU_BASH_AC_SETUP_PATH=${_path2.default.join(this.completionsPath, 'bash_setup')} && test -f $HEROKU_BASH_AC_SETUP_PATH && source $HEROKU_BASH_AC_SETUP_PATH;`); break; default: this.out.error(`No autocomplete script for ${shell}. Run $ heroku autocomplete for install instructions.`); } } } exports.default = AutocompleteScript; AutocompleteScript.topic = 'autocomplete'; AutocompleteScript.command = 'script'; AutocompleteScript.description = 'outputs autocomplete config script for shells'; AutocompleteScript.hidden = true; AutocompleteScript.args = [{ name: 'shell', description: 'shell type', required: false }];