Socket
Socket
Sign inDemoInstall

cli-ator

Package Overview
Dependencies
50
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cli-ator

A cli tool to build cli tools FASTER


Version published
Weekly downloads
2
Maintainers
1
Install size
1.89 MB
Created
Weekly downloads
 

Readme

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

Last updated on 06 Jul 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc