New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sergeant

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sergeant

A CLI solution inspired by [Commander.js](https://github.com/tj/commander.js) and [gulp](https://github.com/gulpjs/gulp).

  • 6.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

sergeant

A CLI solution inspired by Commander.js and gulp.

Essentially I was using gulp for all sorts of things, and got sick of having to either separate anything that had parameters out of the gulpfile, or just convert those parameters into options. Also I was not happy with any of the existing option parsers. And I wanted built in help with colors.

an example

var sergeant = require('sergeant')
var app = sergeant({
  description: 'an example application'
})

app.command('command1', {
  // the settings object is optional
  // description, parameters, and options are used for --help
  description: 'an example command',
  parameters: {
    parameter1: 'an example parameter'
  },
  options: {
    '--option1': 'an example option'
  },
  // aliases are converted to options
  aliases: {
    o: { option1: true }
    'not-option1': { option1: false }
  }
}, function (parameter1, options, done) {

  // validate parameters and options by throwing exceptions
  assert.ok(typeof parameter1 === 'string')

  // actions can have any number of parameters
  // they can use the done callback, or use any of the other strategies of completion supported by async-done

  done()
})

app.command('command2',
  // parallel and series return a function that takes options and done. Options are passed along to all nested functions when run. Every function may use the done callback or anything supported by async-done
  sergeant.parallel(
  function (options, done) {

  },
  sergeant.series(
    function (options) {

    },
    function (options) {

    }
  )
))

FAQs

Package last updated on 04 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc