Skip to main content

CommandArgDefinition

@webda/compiler


Type Alias: CommandArgDefinition

CommandArgDefinition = object

Defined in: definition.ts:303

Definition of a single CLI argument for a CommandDefinition.

Generated by the compiler from method parameter analysis:

  • type from TypeScript type annotation
  • default from parameter initializer
  • required when no default and no ? modifier
  • alias, description, deprecated from JSDoc tags on the parameter

Example​

{
"type": "number",
"default": 18080,
"alias": "p",
"description": "Port to listen on"
}

Properties​

alias?​

optional alias?: string

Defined in: definition.ts:323

Single-character alias for the flag (e.g., "p" for --port). Extracted from the @alias JSDoc tag on the parameter.


default?​

optional default?: any

Defined in: definition.ts:313

Default value from the method parameter initializer. Omitted if the parameter has no default.


deprecated?​

optional deprecated?: string

Defined in: definition.ts:333

Deprecation message. When present, the CLI warns users that this flag is deprecated. Extracted from the @deprecated JSDoc tag.


description?​

optional description?: string

Defined in: definition.ts:328

Help text displayed in --help output for this argument. Extracted from the @description JSDoc tag on the parameter.


required?​

optional required?: boolean

Defined in: definition.ts:318

true if the parameter has no default value and no ? modifier, meaning the user must provide this argument. Omitted when false.


type​

type: "string" | "number" | "boolean"

Defined in: definition.ts:308

The argument type, determining how the CLI parses the value. Mapped from the TypeScript type annotation on the method parameter.