gae-ayaml-env
Version:
Generates an app.yaml file from a template and environment variables
37 lines (36 loc) • 1.35 kB
JavaScript
;
const command_1 = require("@oclif/command");
const controller_1 = require("./controller");
class AppyamlGenerator extends command_1.Command {
async run() {
const { args, flags } = this.parse(AppyamlGenerator);
const fileName = args.file || 'app.template.yaml';
const prefix = flags.prefix || 'ENV_';
const noOutput = flags['no-output'] || false;
try {
const newFile = controller_1.generate({ appYamlTemplatePath: fileName, envPrefix: prefix });
if (noOutput) {
console.log('Generated new app.yaml');
}
else {
this.log(`Generated new app.yaml
${newFile}`);
}
}
catch (err) {
this.error(err);
}
}
}
AppyamlGenerator.description = 'describe the command here';
AppyamlGenerator.flags = {
// add --version flag to show CLI version
version: command_1.flags.version({ char: 'v' }),
help: command_1.flags.help({ char: 'h' }),
// flag with no value (-f, --force)
prefix: command_1.flags.string({ char: 'p', description: 'Enviorment varible prefix, defaults to ENV_' }),
force: command_1.flags.boolean({ char: 'f' }),
'no-output': command_1.flags.boolean(),
};
AppyamlGenerator.args = [{ name: 'file' }];
module.exports = AppyamlGenerator;