import jamslogging = require("./jamslogging"); import jamsglobal = require("./jamsglobal"); import config = require("./config"); export class HelpOption { // #region Properties shortcut: string; command: string; commandtext: string; description: string; valuetype: StringConstructor | NumberConstructor | BooleanConstructor | DateConstructor; defaultvalue: string; isoption: boolean; regex: string; // #endregion // #region Constructor constructor(shortcut: string, command: string, commandtext: string = "", valuetype: string = "", regex: any = "", defaultvalue: any = "", isoption: boolean = true) { var configuration = new config.Config(); var global = new jamsglobal.Global(configuration.locale, configuration); this.shortcut = shortcut; this.command = command; this.commandtext = commandtext === "" ? command : command + " " + commandtext; this.description = global.getText(`help${this.command}`); this.valuetype = getValueType(valuetype); this.defaultvalue = defaultvalue; this.regex = regex; this.isoption = isoption; } // #endregion // #region Methods // #endregion } // #region Helper Functions function getValueType(valuetype: string) { var returnValue: StringConstructor | NumberConstructor | BooleanConstructor | DateConstructor; switch (valuetype.toLowerCase()) { case "string": returnValue = String; break; case "int": returnValue = Number; break; case "boolean": returnValue = Boolean; break; case "date": returnValue = Date; break; default: returnValue = null; break; } return returnValue; } function getConfig(): any { var conf = new config.Config(); // Uncomment and modify to override configuration value // conf.host = "left"; // conf.port = "80"; // conf.product = "JAMS/api"; // conf.encoding = "utf8"; // conf.contenttype = "application/json"; // conf.filemode = 384; // Owner read/write, no other user has access // conf.fileflag = "w"; // conf.locale = "en-us" return conf; } // #endregion