CommonOptionConfig

type

Properties

NameTypeDescription
alias?(string | AliasConfig)[]Provide an array of aliases for the option. Each entry may be a string, or an object with `{ name, hidden }`. When `hidden: true` is set, the alias still works when parsing arguments but will not be displayed in help output or generated documentation.
choices?TChoices | () => TChoicesProvide an array of choices for the option. Values not in the array will throw an error.
coerce?(value: T) => TCoerceProvide a function to coerce the value of the option.
default?Default<NoInfer<T>>Provide a default value for the option. If the default value is a tuple, the first value will be used as the default value, and the second value will be used as the description.
deprecated?stringIf set, the option will be marked as deprecated, with the provided message. This will not effect runtime behavior, but will be displayed in help output and generated docs.
description?stringProvide a description for the option.
env?string | boolean | { key?: string; populate?: boolean; prefix?: boolean; reflect?: boolean }If set, the option will be populated from the environment variable `${env}_${optionName}`. If set to true, the environment variable will be `${optionName}`. If explicitly set to false, environment variable population will be disabled for this option.
group?stringCan be set to group options in help output and generated docs.
hidden?booleanIf true, the option will not be displayed in help output or generated docs.
positional?booleanIf set to true, the option will be treated as a positional argument.
required?booleanIf true, the option is required.
validate?(value: TCoerce) => boolean | stringProvide a function to validate the value of the option.