diff --git a/src/cli/cli.ts b/src/cli/cli.ts index 8d9be2b1df..b2b0f4edde 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -90,7 +90,11 @@ export const GLOBAL_OPTIONS = { loglevel: new ChoicesParameter({ alias: "l", choices: logLevelChoices, - help: "Set logger level, values can be either string or numeric", + help: + "Set logger level. Values can be either string or numeric and are prioritized from 0 to 5 " + + "(highest to lowest) as follows: error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5", + hints: + "[enum] [default: info] [error || 0, warn || 1, info || 2, verbose || 3, debug || 4, silly || 5]", defaultValue: LogLevel[LogLevel.info], }), output: new ChoicesParameter({ diff --git a/src/cli/helpers.ts b/src/cli/helpers.ts index bcff60e7c6..597f9f8f43 100644 --- a/src/cli/helpers.ts +++ b/src/cli/helpers.ts @@ -25,7 +25,6 @@ export const styleConfig = { usagePrefix: str => ( ` ${chalk.bold(str.slice(0, 5).toUpperCase())} - ${chalk.italic(str.slice(7))}` ), usageCommandPlaceholder: str => chalk.blue(str), @@ -34,7 +33,7 @@ ${chalk.bold(str.slice(0, 5).toUpperCase())} usageOptionsPlaceholder: str => chalk.yellow(str), group: (str: string) => { const cleaned = str.endsWith(":") ? str.slice(0, -1) : str - return chalk.bold(cleaned.toUpperCase()) + "\n" + return chalk.bold(cleaned.toUpperCase()) }, flags: (str, _type) => { const style = str.startsWith("-") ? chalk.green : chalk.magenta @@ -115,6 +114,7 @@ export interface SywacOptionConfig { defaultValue?: any choices?: any[] required?: boolean + hints?: string strict: true } @@ -122,6 +122,7 @@ export function prepareOptionConfig(param: Parameter): SywacOptionConfig { const { defaultValue, help: desc, + hints, required, type, } = param @@ -136,6 +137,7 @@ export function prepareOptionConfig(param: Parameter): SywacOptionConfig { desc, required, type, + hints, strict: true, } if (type === "choice") { diff --git a/src/commands/base.ts b/src/commands/base.ts index 9e022be62e..3f4b9e7544 100644 --- a/src/commands/base.ts +++ b/src/commands/base.ts @@ -23,6 +23,7 @@ export interface ParameterConstructor { alias?: string, defaultValue?: T, valueName?: string, + hints?: string, overrides?: string[], } @@ -35,13 +36,15 @@ export abstract class Parameter { help: string required: boolean alias?: string + hints?: string valueName: string overrides: string[] - constructor({ help, required, alias, defaultValue, valueName, overrides }: ParameterConstructor) { + constructor({ help, required, alias, defaultValue, valueName, overrides, hints }: ParameterConstructor) { this.help = help this.required = required || false this.alias = alias + this.hints = hints this.defaultValue = defaultValue this.valueName = valueName || "_valueType" this.overrides = overrides || []