PHP Class JBZoo\Utils\Cli

Exibir arquivo Open project: jbzoo/utils Class Usage Examples

Public Methods

Method Description
build ( string $command, array $args = [] ) : string Build params for cli options
check ( ) : boolean Is command line
err ( string $message, boolean $addEol = true ) Print line to std error
exec ( string $command, array $args = [], null $cwd = null, boolean $verbose = false ) : string Execute cli commands
getNumberOfColumns ( ) : integer Returns the number of columns of the terminal.
hasColorSupport ( ) : boolean Returns true if STDOUT supports colorization.
isInteractive ( integer | resource $fileDescriptor = self::STDOUT ) : boolean Returns if the file descriptor is an interactive terminal or not.
out ( string $message, boolean $addEol = true ) Print line to std out

Method Details

build() public static method

Build params for cli options
public static build ( string $command, array $args = [] ) : string
$command string
$args array
return string

check() public static method

Is command line
public static check ( ) : boolean
return boolean

err() public static method

Print line to std error
public static err ( string $message, boolean $addEol = true )
$message string
$addEol boolean

exec() public static method

Execute cli commands
public static exec ( string $command, array $args = [], null $cwd = null, boolean $verbose = false ) : string
$command string
$args array
$cwd null
$verbose boolean
return string

getNumberOfColumns() public static method

Returns the number of columns of the terminal.
public static getNumberOfColumns ( ) : integer
return integer

hasColorSupport() public static method

This code has been copied and adapted from Symfony\Component\Console\Output\OutputStream.
public static hasColorSupport ( ) : boolean
return boolean

isInteractive() public static method

Returns if the file descriptor is an interactive terminal or not.
public static isInteractive ( integer | resource $fileDescriptor = self::STDOUT ) : boolean
$fileDescriptor integer | resource
return boolean

out() public static method

Print line to std out
public static out ( string $message, boolean $addEol = true )
$message string
$addEol boolean