Skip to content

A library on top of commander.js that provides a more opinionated API.

Notifications You must be signed in to change notification settings

AlexDoutsinis/izicli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

izicli

A library on top of commander.js that provides a more opinionated API.

Install

npm i izicli

Examples

// file: sample.js
import program from './index.js'

program.version('0.0.1')

program
  .command({ name: 'say', description: 'dummy command' })
  .options([
    {
      name: { full: 'value', short: 'v' },
      description: 'dummy option',
      acceptMultipleValues: false,
      isRequired: true,
      valueIsRequired: true,
    },
  ])
  .action(options => {
    const { value } = options

    console.log(value)
  })

program.parse(process.argv)

Usage:

node sample.js say -v "hello"
// file: sample.js
import program from './index.js'

program.version('0.0.1')

program
  .command({ name: 'say', description: 'dummy command' })
  .argument({
    name: 'value',
    description: 'dummy argument',
    isRequired: true,
    acceptMultipleValues: false,
  })
  .action(value => {
    console.log(value)
  })

program.parse(process.argv)

Usage:

node sample.js say "hello"

About

A library on top of commander.js that provides a more opinionated API.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published