$_output
$_output : resource
The output pipe.
Horde_Cli API for basic command-line functionality/checks.
$_color : \Horde_Cli_Color
The color formatter.
__construct(array $opts = array())
Detect the current environment (web server or console) and sets internal values accordingly.
Use init() if you also want to set environment variables that may be missing in a CLI environment.
array | $opts | Configuration options:
|
color(string $color, string $text) : string
Returns a colored version of $text.
string | $color | The color to use. @see $_foregroundColors |
string | $text | The text to print in this color. |
The colored text.
since |
Horde_Cli 2.1.0 |
---|
red(string $text) : string
Returns a red version of $text.
string | $text | The text to print in red. |
The red text.
None found |
green(string $text) : string
Returns a green version of $text.
string | $text | The text to print in green. |
The green text.
None found |
blue(string $text) : string
Returns a blue version of $text.
string | $text | The text to print in blue. |
The blue text.
None found |
yellow(string $text) : string
Returns a yellow version of $text.
string | $text | The text to print in yellow. |
The yellow text.
None found |
header(string $message, string $below = '-', string $above = null)
Creates a header from a string by drawing character lines above or below the header content.
string | $message | A message to turn into a header. |
string | $below | Character to use for drawing the line below the message. |
string | $above | Character to use for drawing the line above the message. |
since |
Horde_Cli 2.1.0 |
---|
message( $message, string $type = 'cli.message')
Displays a message.
$message | ||
string | $type | The type of message: 'cli.error', 'cli.warning', 'cli.success', or 'cli.message'. |
None found |
fatal(mixed $error)
Displays a fatal error message.
mixed | $error | The error text to display, an exception or an object with a getMessage() method. |
None found |
block(string $text, string $color, string $margin = '', integer $width = null) : string
Formats text in a visual block with optional margin.
string | $text | The block text. |
string | $color | The background color. |
string | $margin | The block margin string. |
integer | $width | The block width. |
The formatted block.
since |
Horde_Cli 2.2.0 |
---|
prompt(string $prompt, array $choices = null, string $default = null) : mixed
Prompts for a user response.
string | $prompt | The message to display when prompting the user. |
array | $choices | The choices available to the user or null for a text input. |
string | $default | The default value if no value specified. |
The user's response to the prompt.
todo |
Horde 5: switch $choices and $default |
---|
passwordPrompt(string $prompt) : string
Interactively prompts for input without echoing to the terminal.
Requires a bash shell or Windows and won't work with safe_mode settings (uses shell_exec).
From: http://www.sitepoint.com/blogs/2009/05/01/interactive-cli-password-prompt-in-php/
string | $prompt | The message to display when prompting the user. |
The user's response to the prompt.
None found |
readStdin() : string
Reads everything that is sent through standard input and returns it as a single string.
The contents of the standard input.
None found |
init(array $opts = array()) : \Horde_Cli
CLI scripts shouldn't timeout, so try to set the time limit to none. Also initialize a few variables in $_SERVER that aren't present from the CLI.
array | $opts | Configuration options:
|
A Horde_Cli instance.
None found |
runningFromCLI() : boolean
Make sure we're being called from the command line, and not via the web.
True if we are, false otherwise.
None found |