Class Options
Class Options
Parses command line options passed to the CLI script. Allows CLI scripts to easily register all accepted options and commands and even generates a help text from this setup.
Direct known subclasses
splitbrain\phpcli\tests\Options
Namespace: splitbrain\phpcli
License: MIT
Author: Andreas Gohr andi@splitbrain.org
Located at src/Options.php
License: MIT
Author: Andreas Gohr andi@splitbrain.org
Located at src/Options.php
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
registerArgument( string $arg, string $help, boolean $required = true, string $command = '' )
Register the names of arguments for help generation and number checking |
public
|
|
public
|
#
registerOption( string $long, string $help, string|null $short = null, boolean|string $needsarg = false, string $command = '' )
Register an option for option parsing and help generation |
public
|
|
public
|
|
public
boolean|string|string[]
|
|
public
string
|
|
public
array
|
|
public
string
|
protected
array
|
$setup
keeps the list of options to parse |
|
protected
array
|
$options
store parsed options |
#
array()
|
protected
string
|
$command
current parsed command if any |
#
''
|
protected
array
|
$args
passed non-option arguments |
#
array()
|
protected
string
|
$bin
the executed script |
|
protected
|
$colors
for colored help output |
|
protected
string
|
$newline
newline used for spacing help texts |
#
"\n"
|