@heroku-cli/plugin-autocomplete
Version:
<!-- usage --> ```sh-session $ heroku plugins:install @heroku-cli/plugin-autocomplete $ heroku autocomplete ... ``` <!-- usagestop --> # Commands <!-- commands --> * [`heroku autocomplete [SHELL]`](#heroku-autocomplete-shell)
62 lines (61 loc) • 2.16 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("@heroku-cli/command");
const Completions = require("@heroku-cli/command/lib/completions");
const app_1 = require("@heroku-cli/command/lib/flags/app");
const ConfigCompletion = {
cacheDuration: 60 * 60 * 24 * 7,
cacheKey: async (ctx) => {
return ctx.flags && ctx.flags.app ? `${ctx.flags.app}_config_vars` : '';
},
options: async (ctx) => {
const heroku = new command_1.APIClient(ctx.config);
if (ctx.flags && ctx.flags.app) {
let { body: configs } = await heroku.get(`/apps/${ctx.flags.app}/config-vars`);
return Object.keys(configs);
}
return [];
},
};
const ConfigSetCompletion = {
cacheDuration: 60 * 60 * 24 * 7,
cacheKey: async (ctx) => {
return ctx.flags && ctx.flags.app ? `${ctx.flags.app}_config_set_vars` : '';
},
options: async (ctx) => {
const heroku = new command_1.APIClient(ctx.config);
if (ctx.flags && ctx.flags.app) {
let { body: configs } = await heroku.get(`/apps/${ctx.flags.app}/config-vars`);
return Object.keys(configs).map(k => `${k}=`);
}
return [];
},
};
exports.CompletionMapping = {
app: app_1.AppCompletion,
addon: Completions.AppAddonCompletion,
dyno: Completions.AppDynoCompletion,
buildpack: Completions.BuildpackCompletion,
config: ConfigCompletion,
configSet: ConfigSetCompletion,
dynosize: Completions.DynoSizeCompletion,
pipeline: Completions.PipelineCompletion,
processtype: Completions.ProcessTypeCompletion,
region: Completions.RegionCompletion,
remote: app_1.RemoteCompletion,
role: Completions.RoleCompletion,
scope: Completions.ScopeCompletion,
space: Completions.SpaceCompletion,
stack: Completions.StackCompletion,
stage: Completions.StageCompletion,
team: Completions.TeamCompletion,
};
exports.CompletionBlacklist = {
app: ['apps:create'],
};
exports.CompletionAliases = {
key: 'config',
};
exports.CompletionVariableArgsLookup = {
'config:set': 'configSet',
};
;