UNPKG

1.12 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const core_1 = require("@oclif/core");
4const path = require("path");
5const base_1 = require("../../base");
6class Script extends base_1.AutocompleteBase {
7 async run() {
8 const { args } = await this.parse(Script);
9 const shell = args.shell || this.config.shell;
10 this.errorIfNotSupportedShell(shell);
11 const binUpcase = this.cliBinEnvVar.replace(/-/g, '_');
12 const shellUpcase = shell.toUpperCase();
13 this.log(`${this.prefix}${binUpcase}_AC_${shellUpcase}_SETUP_PATH=${path.join(this.autocompleteCacheDir, `${shell}_setup`)} && test -f $${binUpcase}_AC_${shellUpcase}_SETUP_PATH && source $${binUpcase}_AC_${shellUpcase}_SETUP_PATH;${this.suffix}`);
14 }
15 get prefix() {
16 return '\n';
17 }
18 get suffix() {
19 return ` # ${this.cliBin} autocomplete setup\n`;
20 }
21}
22exports.default = Script;
23Script.description = 'outputs autocomplete config script for shells';
24Script.hidden = true;
25Script.args = {
26 shell: core_1.Args.string({ description: 'shell type', required: false }),
27};