<commit_before># Declarative CLI parsing for node apps

This is a library designed to express command-line options. It supports
commands and subcommands (at an arbitrary depth), automatically generates help
text and `usage` contents. You can use custom parsers for attributes and
options values (types supported out of the box: `int`, `bool`, `string`).


## Enough talk, show me the code

```javascript
var cliparse = require("cliparse");
var parsers = cliparse.parsers;

var cliParser = cliparse.cli({
  name: "my-executable",
  description: "Simple CLI written for the sake of the example",
  options: [
    cliparse.flag("help", { aliases: ["h", "?"], helpT: "display help" })
  ],
  commands: [

    cliparse.command(
      "echo",
      { description: "display the given value",
        args: [ cliparse.argument("value", { helpT: "simple value" })],
        options: [ cliparse.flag("reverse", { aliases: ["r"], helpT: "reverse the value"}) ]
      },
      echoModule),

    cliparse.command(<commit_msg>optparse-applicative is great. Learn haskell and use it<commit_after># Declarative CLI parsing for node apps

This is a library designed to express command-line options. It supports
commands and subcommands (at an arbitrary depth), automatically generates help
text and `usage` contents. You can use custom parsers for attributes and
options values (types supported out of the box: `int`, `bool`, `string`).

Its design is vaguely inspired from
[optparse-applicative](https://hackage.haskell.org/package/optparse-applicative)
which is a great CLI parsing library. JS being not as expressive as Haskell, a
direct port is not possible.


## Enough talk, show me the code

```javascript
var cliparse = require("cliparse");
var parsers = cliparse.parsers;

var cliParser = cliparse.cli({
  name: "my-executable",
  description: "Simple CLI written for the sake of the example",
  options: [
    cliparse.flag("help", { aliases: ["h", "?"], helpT: "display help" })
  ],
  commands: [

    cliparse.command(
      "echo",
      { description: "display the given value",
        args: [ cliparse.argument("value", { helpT: "simple value" })],
        options: [ cliparse.flag("reverse", { aliases: ["r"], helpT: "reverse the value"}) ]
      },
      echoModule),

    cliparse.command(
{'fraction_non_alphanumeric': 0.1212914485165794, 'fraction_numerical': 0.0, 'mean_word_length': 3.963203463203463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2157833', 'n_tokens_mistral': 679, 'n_tokens_neox': 644, 'n_words': 251}