namespace \webfiori\framework\cli
abstract class CLICommand
Class Attributes Summary
Class Methods Summary
Class Attributes Details
Class Methods Details
Parameters:
- string $commandName A string that represents the name of the command such as '-v' or 'help'. If not provided, the value 'new-command' is used.
- array $args An associative array of sub-associative arrays of arguments (or options) which can be supplied to the command when running it. The key of each sub array is argument name. Each sub-array can have the following indices as argument options:
- optional: A boolean. if set to true, it means that the argument is optional and can be ignored when running the command.
- default: An optional default value for the argument to use if it is not provided and is optional.
- description: A description of the argument which will be shown if the command 'help' is executed.
- values: A set of values that the argument can have. If provided, only the values on the list will be allowed. Note that if null or empty string is in the array, it will be ignored. Also, if boolean values are provided, true will be converted to the string 'y' and false will be converted to the string 'n'.
- string $description A string that describes what does the job do. The description will appear when the command 'help' is executed.
Parameters:
- string $name The name of the argument. It must be non-empty string and does not contain spaces. Note that if the argument is already added and the developer is trying to add it again, the new options array will override the existing options array.
- array $options An optional array of options. Available options are:
- optional: A boolean. if set to true, it means that the argument is optional and can be ignored when running the command.
- default: An optional default value for the argument to use if it is not provided and is optional.
- description: A description of the argument which will be shown if the command 'help' is executed.
- values: A set of values that the argument can have. If provided, only the values on the list will be allowed. Note that if null or empty string is in the array, it will be ignored. Also, if boolean values are provided, true will be converted to the string 'y' and false will be converted to the string 'n'.
Parameters:
- array $arr An associative array of sub associative arrays. The key of each sub array is argument name. Each sub-array can have the following indices:
- optional: A boolean. if set to true, it means that the argument is optional and can be ignored when running the command.
- default: An optional default value for the argument to use if it is not provided and is optional.
- description: A description of the argument which will be shown if the command 'help' is executed.
- values: A set of values that the argument can have. If provided, only the values on the list will be allowed. Note that if null or empty string is in the array, it will be ignored. Also, if boolean values are provided, true will be converted to the string 'y' and false will be converted to the string 'n'.
Parameters:
- int $numberOfCols Number of columns to clear. The columns that will be cleared are before and after cursor position. They don't include the character at which the cursor is currently pointing to.
- boolean $beforeCursor If set to true, the characters which are before the cursor will be cleared. Default is true.
Parameters:
Parameters:
- string $message The message that will be shown.
Parameters:
- string $string The string that will be formatted.
- array $formatOptions An associative array of formatting options. Supported options are:
- color: The foreground color of the output text. Supported colors are:
- white
- black
- red
- light-red
- green
- light-green
- yellow
- light-yellow
- gray
- blue
- light-blue
- bg-color: The background color of the output text. Supported colors are the same as the supported colors by the 'color' option.
- bold: A boolean. If set to true, the text will be bold.
- underline: A boolean. If set to true, the text will be underlined.
- reverse: A boolean. If set to true, the foreground color and background color will be reversed (invert the foreground and background colors).
- blink: A boolean. If set to true, the text will blink.
- color: The foreground color of the output text. Supported colors are:
Parameters:
- string $argName The name of the argument.
- optional: A booleean which is set to true if the argument is optional.
- description: The description of the argument. Appears when help command is executed.
- default: A default value for the argument. It will be not set if no default value for the argument is provided.
- values: A set of values at which the argument can have.
- provided: Set to true if the argument is provided in command line interface.
- val: The value of the argument taken from the command line interface.
Parameters:
- string $optionName The name of the option.
- optional
- description
- default
- Note that the last index might not be set.
Parameters:
- string $prompt The string that will be shown to the user. The string must be non-empty.
- string $default An optional default value to use in case the user hit "Enter" without entering any value. If null is passed, no default value will be set.
- callable $validator A callback that can be used to validate user input. The callback accepts one parameter which is the value that the user has given. If the value is valid, the callback must return true. If the callback returns anything else, it means the value which is given by the user is invalid and this method will ask the user to enter the value again.
Parameters:
- string $argName The name of the command line argument.
Parameters:
- string $message The message that will be shown.
Parameters:
- string $argName The name of the command line argument.
Parameters:
- int $lines The number of lines the cursor will be moved. Default value is 1.
Parameters:
- int $numberOfCols The number of columns the cursor will be moved. Default value is 1.
Parameters:
- int $numberOfCols The number of columns the cursor will be moved. Default value is 1.
Parameters:
Parameters:
- int $lines The number of lines the cursor will be moved. Default value is 1.
Parameters:
- array $array The array that will be printed.
Parameters:
- string $str The string that will be printed.
- mixed $_ One or more extra arguments that can be supplied to the method. The last argument can be an array that contains text formatting options. for available options, check the method CLICommand::formatOutput().
Parameters:
- string $str The string that will be printed.
- mixed $_ One or more extra arguments that can be supplied to the method. The last argument can be an array that contains text formatting options. for available options, check the method CLICommand::formatOutput().
Parameters:
- unkown_type $bytes
Parameters:
Parameters:
- If the argument can have a specific set of values and the given value is not one of them.
- The given value is empty string or null.
Parameters:
- string $str A string that describes the command. It must be non-empty string.
Parameters:
- InputStream $stream An instance that implements an input stream.
Parameters:
- string $name The name of the command (such as 'v' or 'help'). It must be non-empty string and does not contain spaces.
Parameters:
- OutputStream $stream An instance that implements output stream.
Parameters:
- string $message The message that will be displayed.
Parameters:
- string $message The message that will be shown.