Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cli-ator

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-ator

A cli tool to build cli tools FASTER

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

cli-ator

A cli tool to create cli tools FASTER 🚀

Install

npm i cli-ator

Usage

const cli = require('cli-ator')

const insta = cli({
  printer: console.log, // default
  log: 'info',
  helpPath: 'man/',
  help: 'README.md',
  helpArg: 'help',
  autoloadPath: 'commands/',
  commands: [
    {
      command: 'demo',
      commandPath: 'command/',
      help: 'README.md',
      handler: (args, logger) => { 
        logger.info('My output')
        return 42
      },
      inputArguments: { /* config */ }
    }
  ]
})

insta.on('start', (command, parsedArgs) => {
  // emitted just before the command
})

insta.on('end', (command, result) => {
  // emitted if the command complete successfully. The result contains the returned value of the handler
})

insta.on('error', (error, command) => {
  // emitted when the command handler throws an error or reject a promise
})

insta.on('not-found', (args) => {
  // emitted when the command args don't match any command
})

// exectute the command based on the arguments
insta.execute(process.argv.splice(2))

FAQs

Package last updated on 06 Jul 2019

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