commist

WebJar for commist

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

commist
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

commist
WebJar for commist
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mcollina/commist

Download commist

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/commist/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>commist</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/commist/
implementation 'org.webjars.npm:commist:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/commist/
implementation ("org.webjars.npm:commist:1.0.0")
'org.webjars.npm:commist:jar:1.0.0'
<dependency org="org.webjars.npm" name="commist" rev="1.0.0">
  <artifact name="commist" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='commist', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "commist" % "1.0.0"
[org.webjars.npm/commist "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : leven jar [1.0.0,2)
org.webjars.npm : minimist jar [1.1.0,2)

Project Modules

There are no modules declared in this project.

commist

Build Status

Build command line application with multiple commands the easy way. To be used with minimist.

var program = require('commist')()
  , minimist = require('minimist')
  , result

result = program
  .register('abcd', function(args) {
    console.log('just do', args)
  })
  .register({ command: 'restore', equals: true }, function(args) {
    console.log('restore', args)
  })
  .register('args', function(args) {
    args = minimist(args)
    console.log('just do', args)
  })
  .register('abcde code', function(args) {
    console.log('doing something', args)
  })
  .register('another command', function(args) {
    console.log('anothering', args)
  })
  .parse(process.argv.splice(2))

if (result) {
  console.log('no command called, args', result)
}

When calling commist programs, you can abbreviate down to three char words. In the above example, these are valid commands:

node example.js abc
node example.js abc cod
node example.js anot comm

Moreover, little spelling mistakes are corrected too:

node example.js abcs cod

If you want that the command must be strict equals, you can register the command with the json configuration:

  program.register({ command: 'restore', strict: true }, function(args) {
    console.log('restore', args)
  })

Acknowledgements

This project was kindly sponsored by nearForm.

License

MIT

Versions

Version
1.0.0