A list of cli options/keywords that should normally be censored
Used as the place holder when censoring arguments in messages/command output
Accepts the yargs argument object and constructs the base imperative argument object. The objects are identical to maintain compatibility with existing CLIs and plugins, but the intent is to eventually phase out having CLIs import anything from Yargs (types, etc).
Yargs argument object
Copy and censor any sensitive CLI arguments before logging/printing
The args list to censor
Copy and censor a yargs argument object before logging
the args to censor
a censored copy of the arguments
Convert an array of strings provided as an environment variable
String form of the array
String[] based on environment variable
Accepts the full set of command options and extracts their values from environment variables that are set.
the full set of options specified on the command definition. Includes both the option definitions and the positional definitions.
Format the help header - normally used in help generation etc.
Get the 'dash form' of an option as it would appear in a user's command, appending the proper number of dashes depending on the length of the option name
e.g. my-option
Get the value of an environment variable associated with the specified option name. The environment variable name will be formed by concatenating an environment name prefix, and the cmdOption using underscore as the delimiter.
The cmdOption name can be specified in camelCase or in kabab-style. Regardless of the style, it will be converted to upper case. We replace dashes in Kabab-style values with underscores. We replace each uppercase character in a camelCase value with underscore and that character.
The envPrefix will be used exactly as specified.
Example: The values myEnv-Prefix and someOptionName would retrieve the value of an environment variable named myEnv-Prefix_SOME_OPTION_NAME
The prefix for environment variables for this CLI. Our caller can use the value obtained by ImperativeConfig.instance.envVariablePrefix, which will use the envVariablePrefix from the Imperative config object, and will use the rootCommandName as a fallback value.
The name of the option in either camelCase or kabab-style.
Accepts the full set of loaded profiles and attempts to match the option names supplied with profile keys.
the profile definition on the command.
the full set of command options for the command being processed
Takes a key and converts it to both camelCase and kebab-case.
The key to transform
An object that contains the new format.
Constructs the yargs style positional argument string.
Indicates that this positional is required
The name of the positional
Using Object.assign(), merges objects in the order they appear in call. Object.assign() copies and overwrites existing properties in the target object, meaning property precedence is least to most (left to right).
See details on Object.assign() for nuance.
variadic set of objects to be merged
Display a prompt that hides user input and reads from stdin DOES NOT WORK WITH COMMANDS THAT ALSO READ STDIN Useful for prompting the user for sensitive info such as passwords Synchronous
The message to display to the user e.g. "Please enter password:"
value - the value entered by the user
Prompt the user with a question and wait for an answer, but only up to the specified timeout.
The text with which we will prompt the user.
Should we hide the text. True = display stars. False = display text. Default = false.
The number of seconds that we will wait for an answer. If not supplied, the default is 600 seconds.
A string containing the user's answer, or null if we timeout.
Prompt the user with a question and wait for an answer, but only up to the specified timeout.
The text with which we will prompt the user.
A string containing the user's answer, or null if we timeout.
Accepts an option name, and array of option aliases, and their value and returns the arguments style object.
The command option name, usually in kebab case (or a single word)
An array of alias names for this option
The value to assign to the argument
Display a message when the command is deprecated.
the IHandlerParameters supplied to a command handler's process() function.
Sleep for the specified number of miliseconds.
Number of miliseconds to sleep
Generated using TypeDoc
Cli Utils contains a set of static methods/helpers that are CLI related (forming options, censoring args, etc.)