A library for easily creating observable CLI tasks with support for commands, arguments, and options.
Go to file
2016-11-19 17:41:11 +01:00
dist cleanup 2016-11-19 13:43:06 +01:00
docs improve typings and docs 2016-09-04 17:32:12 +02:00
test cleanup 2016-11-19 13:43:06 +01:00
ts cleanup 2016-11-19 13:43:06 +01:00
.gitignore update smartcli 2016-09-04 17:23:29 +02:00
.gitlab-ci.yml fix ci 2016-09-04 17:36:07 +02:00
LICENSE Initial commit 2015-10-04 23:06:36 +02:00
npmts.json update dependencies 2016-05-23 04:09:06 +02:00
package.json Update Metadata 2016-11-19 17:41:11 +01:00
README.md improve README 2016-11-19 15:02:24 +01:00
tslint.json implement standardJS 2016-10-15 00:56:02 +02:00

smartcli

nodejs wrapper for CLI related tasks. TypeScript ready.

Availabililty

npm git git docs

Status for master

build status coverage report Dependency Status bitHound Dependencies bitHound Code TypeScript node

Install the package

npm install smartcli --save

Usage

this plugin tries to establish some logic in which CLI tools work.

take the following commandline input:

mytool function argument1 argument2 --option1 -o2 option2Value
  • 'mytool' obviously is the tool (like git)
  • function is the main thing the tool shall do (like commit)
  • argument1 and argument2 are arguments
  • option1 is a longform option you can add (like --message for message)
  • optionValue is the referenced option value (like a commit message)
import {Smartcli} from "smartcli"
mySmartcli = new Smartcli();
mySmartcli.standardTask()
  .then(argvArg => {
    // do something if program is called without an command
  });

mySmartcli.addCommand({commandname: 'install'})
  .then(argvArg => {
    // do something if program is called with command "install"
  })

mySmartcli.addVersion('1.0.0') // -v and --version options will display the specified version in the terminal

mySmartCli.addHelp({ // is triggered by help command and --help option
  helpText: 'some help text to print' // the helpText to display
})

mySmartcli.startParse() // starts the evaluation and fullfills or rejects promises.

npm