1.2.8 • Published 5 years ago

@vimlet/cli v1.2.8

Weekly downloads
144
License
MIT
Repository
-
Last release
5 years ago

Command line interface for node.js. The easiest way to handle your application from console.

Installation

npm install @vimlet/cli

How to use

var cli = require("@vimlet/cli").instantiate();

vimlet-cli accepts flags and values:

  • flag: Commands which don't have value, like a boolean option. flag("shorcut", "flagName", "description")
  • value: Commands that will have a value. value("shorcut", "valueName", "description")

value(shortcut, name, description, handler)

flag(shortcut, name, description)

  • shortcut: they are not mandatory, they can be null o rempty.
  • name: value or flag name.
  • description: String to be shown on help.
  • handler: a function to be applied to the data inserted by the user.

IE:

cli
.flag("w", "windows", "This flag will set the platform as windows")
.value("e", "extension", "This value will tell the extension of the output file")
.flag("h", "--help", "Shows help")
.parse(arg);
  • parse() must be called at the end to parse the arguments.
  • arg arguments is a string that can be taken from console or wherever the user wants.

As an example call: example w e exe => This will set the platform as windows and the extension to exe.

Value also accept a handler as last param

value("t", "--test", "test handler", function(value){return value.split(",");})

In the example above, test data will be splitted by comas.

  • cli.printHelp(); Is a default function to print help in the console like:
ShortcutNameDescription
hhelpPrint help

License

Vimlet Cli is released under MIT License. See LICENSE for details.

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago