# Vimlet Cli
Command line interface for node.js

## First steps

1. Require an instance of vimlet cli.
    `var cli = require("@vimlet/cli").instantiate();`
2. Declare flags and values for your application.
* flag: As its name says, it is a flag with no value expected.
    `flag("shortcut", "flagName", "description");`
* value: A value is expected in this case.
    `value("shorcut", "valueName", "description")`

3. Call parse with argv
    `parse(argv);`
    argv is a string that may come from console or wherever the user decides.


## Example

```[javascript]
var cli = require("@vimlet/cli").instantiate();
cli
.flag("-t", "--test", "test flag")
.value("-i", "--input", "input files")
.value("o", "output", "output files")
.value("-f", "--fruits", "fruit list", handler)
.value("i", "install", "install something")
.flag("s", "start", "start something cool")
.flag("h", "help", "shows help")
.parse(process.argv);
```


## Extra

* Shorcuts are not mandatory, they can be null or empty string "".
* There is a function `printHelp()` That will print autogenerated help in the console like:

|Shortcut|Name|Description|
|---|---|---|
|h|help|Print help|

* Values accept a fourth parameter, a handler to be applied to the data inserted by the user. EI:
    `value("t", "--test", "test handler", function(value){return value.split(",");})`
    The example above will take argv for test and split by commas into an array.