0.1.2 • Published 2 years ago

console-command-manager v0.1.2

Weekly downloads
2
License
ISC
Repository
github
Last release
2 years ago

Console command manager

Build Status Coverage Status

NPM NPM

It run custom bash commands, is able to control your service from console like the think client does.

Be free and ask me questions personally on Gitter

// import { runCommand, extractValue } from 'console-command-manager' // @todo Uncomment at the real case.
import { runCommand, extractValue } from '../src/index'

(async function () {
  await runCommand(
    [
      {
        name: 'print',
        title: 'Prints values',
        handler: async ({request, injection: {console, DateFactory}}) => {
          const format = extractValue(request.args, 'format', 'not_set')
          console.log(`I am printing you text  ' ${request.values.join(' ')}  at ${new DateFactory()} ' format - ${format}`)
        }
      },
    ],
    {
      DateFactory: Date
    },
    process.argv.slice(2)
  )
})()

The command line

npx babel-node ./example/commander.js print --format="A4" some text

Produces such lines

I am printing you text  ' some text  at Fri Mar 20 2020 18:11:19 GMT+0200 (Eastern European Standard Time) ' format - A4

For the full documentation read WIKI

Main parts of the project:

It manages commands, uses own string parser that can be used independently. Command handler could be asynchronous. The code written by the library have to be testable.

0.1.2

2 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago