1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const core_1 = require("@oclif/core");
|
4 | const path = require("path");
|
5 | const base_1 = require("../../base");
|
6 | class 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 | }
|
22 | exports.default = Script;
|
23 | Script.description = 'outputs autocomplete config script for shells';
|
24 | Script.hidden = true;
|
25 | Script.args = {
|
26 | shell: core_1.Args.string({ description: 'shell type', required: false }),
|
27 | };
|