UNPKG

ern-api-gen

Version:

Electrode Native API generator

82 lines 2.53 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:variable-name */ const properties_1 = require("./models/properties"); const properties_2 = require("./models/properties"); const javaUtil_1 = require("./java/javaUtil"); const StringBuilder_1 = __importDefault(require("./java/StringBuilder")); class CliOption { static newBoolean(opt, description) { return new CliOption(opt, description, properties_1.BooleanProperty.TYPE).defaultValue('false'); } static newString(opt, description) { return new CliOption(opt, description, properties_2.StringProperty.TYPE); } constructor(opt, description, type = properties_2.StringProperty.TYPE, short, enumValues, required) { this.opt = opt; this.description = description; this.type = type; } getOpt() { return this.opt; } getDescription() { return this.description; } setDescription(description) { this.description = description; } getType() { return this.type; } setType(type) { this.type = type; } getDefault() { return this.__defaultValue; } setDefault(defaultValue) { this.__defaultValue = defaultValue; } defaultValue(defaultValue) { this.__defaultValue = defaultValue; return this; } addEnum(value, description) { if (this.enumValues == null) { this.enumValues = javaUtil_1.newHashMap(); } if (!this.enumValues.containsKey(value)) { this.enumValues.put(value, description); } return this; } getEnum() { return this.enumValues; } setEnum(enumValues) { this.enumValues = enumValues; } getOptionHelp() { const sb = StringBuilder_1.default(this.description); if (this.__defaultValue != null) { sb.append(' (Default: ') .append(this.__defaultValue) .append(')'); } if (this.enumValues != null) { for (const [key, value] of this.enumValues) { sb.append('\n ') .append(key) .append(' - ') .append(value); } } return sb.toString(); } } exports.default = CliOption; //# sourceMappingURL=CliOption.js.map