README : add installation section

master
Julien Rosset 5 years ago
parent f5ee0314d3
commit 7f5347046c

@ -1,24 +1,28 @@
# PHPCommandLine # PHPCommandLine
__Command line management library in PHP (CLI)__ __Command line management library in PHP (CLI)__
![nb releases](https://badgen.net/github/tags/darkelfe14728/PhpCommandLine?label=Nb%20releases) ![last release](https://badgen.net/packagist/v/darkelfe14728/commandline?label=Last%20release)
![last release](https://badgen.net/github/tag/darkelfe14728/PhpCommandLine?label=Last%20release&color=yellow) ![licence](https://badgen.net/packagist/license/darkelfe14728/commandline?color=red)
![licence](https://badgen.net/badge/license/CC%20BY%204.0/red) ![nb releases](https://badgen.net/packagist/dt/darkelfe14728/commandline?color=green)
A command-line options parser with configurable expects and help auto generation. A command-line options parser with configurable expects and help auto generation.
There is two kind of arguments : There is two kind of arguments :
- options (short/long tag) : _-h_ or _--version_ - options (short/long tag) : _-h_ or _--version_
- values : my/path/to/a/file - values : my/path/to/a/file
## Installation
```
composer require darkelfe14728/commandline
```
### Description ## Description
At first, create a new CommandLine with program name and description. Add options and values by using respectively _addOption_ and _addValue_. At first, create a new CommandLine with program name and description. Add options and values by using respectively _addOption_ and _addValue_.
Default options for help (-h / --help) and version (--version) can be add with _addDefaultArguments_ and use _treatDefaultArguments_ for launching associated treatments. Default options for help (-h / --help) and version (--version) can be add with _addDefaultArguments_ and use _treatDefaultArguments_ for launching associated treatments.
Treat script arguments with _parse_ : return an object of variables. Treat script arguments with _parse_ : return an object of variables.
### Example ## Example
```php ```php
<?php <?php
@ -46,7 +50,7 @@ Would display something like that :
} }
### Automatic help generation ## Automatic help generation
CommandLine provide a generator for command-line of programme. Example : CommandLine provide a generator for command-line of programme. Example :
Checker Checker

Loading…
Cancel
Save