oclif-plugin-completion
Version:
oclif plugin for generating shell completions
32 lines (31 loc) • 986 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompletionBase = void 0;
const command_1 = require("@oclif/command");
const path_1 = require("path");
const get_bin_aliases_1 = require("./utils/get-bin-aliases");
class CompletionBase extends command_1.default {
constructor() {
super(...arguments);
this.aliases = [];
}
async init() {
this.aliases.push(...get_bin_aliases_1.getBinAliases({
bin: this.config.bin,
// this is okay, `@oclif/config` package's `PJSON.CLI` type is too restrictive
// @ts-expect-error
pjson: this.config.pjson,
}));
}
}
exports.CompletionBase = CompletionBase;
CompletionBase.flags = {
shell: command_1.flags.string({
description: 'Name of shell',
char: 's',
env: 'SHELL',
parse: (shell) => path_1.basename(shell),
options: ['bash', 'fish', 'zsh'],
required: true,
}),
};