Lines Matching +full:- +full:- +full:stderr

1 # PHP-CLI
3 PHP-CLI is a simple library that helps with creating nice looking command line scripts.
7 - **option parsing**
8 - **help page generation**
9 - **automatic width adjustment**
10 - **colored output**
11 - **optional PSR3 compatibility**
13 It is lightweight and has **no 3rd party dependencies**. Note: this is for non-interactive scripts …
19 ```php composer.phar require splitbrain/php-cli```
37 $options->setHelp('A very minimal example that does nothing but print a version');
38 $options->registerOption('version', 'print version', 'v');
44 if ($options->getOpt('version')) {
45 $this->info('1.0.0');
47 echo $options->help();
53 $cli->run();
61 - create a class and ``extend splitbrain\phpcli\CLI``
62 - implement the ```setup($options)``` method and register options, arguments, commands and set help…
63 - ``$options->setHelp()`` adds a general description
64 - ``$options->registerOption()`` adds an option
65 - ``$options->registerArgument()`` adds an argument
66 - ``$options->registerCommand()`` adds a sub command
67 - implement the ```main($options)``` method and do your business logic there
68 - ``$options->getOpts`` lets you access set options
69 - ``$options->getArgs()`` returns the remaining arguments after removing the options
70 - ``$options->getCmd()`` returns the sub command the user used
71 - instantiate your class and call ```run()``` on it
73 …nd in the examples directory. Please refer to the [API docs](https://splitbrain.github.io/php-cli/)
79 exit the programm with a non-zero exit code. You can disable this behaviour and catch all exception…
90 then uses terminal colors. You can always suppress colored output by passing ``--no-colors`` to you…
94 ``error()`` (red) or ``fatal()`` (red). The latter will also exit the programm with a non-zero exit…
96 For more complex coloring you can access the color class through ``$this->colors`` in your script. …
116 - fixed width in characters by providing an integer (eg. ``15``)
117 - precentages by provifing an integer and a percent sign (eg. ``25%``)
118 - a single fluid "rest" column marked with an asterisk (eg. ``*``)
126 …s used for the automatic help screen accessible when calling your script with ``-h`` or ``--help``.
128 ## PSR-3 Logging
130 The CLI class is a fully PSR-3 compatible logger (printing colored log data to STDOUT and STDERR). …
140 Note: if your backend code calls for a PSR-3 logger but does not actually type check for the interf…
144 …adjust the verbosity of your CLI tool using the `--loglevel` parameter. Supported loglevels are th…
150 * success (this is not defined in PSR-3)
159 …or all log levels are available. Placeholder interpolation as described in PSR-3 is available, too.
160 Messages from `warning` level onwards are printed to `STDERR` all below are printed to `STDOUT`.