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

commist

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commist

Build your commands on minimist!

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
806K
decreased by-8.82%
Maintainers
1
Weekly downloads
 
Created

What is commist?

The 'commist' npm package is a command-line argument parser that helps in managing and dispatching commands in a CLI application. It allows you to define commands and their respective handlers, making it easier to build complex command-line tools.

What are commist's main functionalities?

Command Registration

This feature allows you to register a command and its handler. In this example, the 'hello' command is registered, and when invoked, it prints 'Hello, world!' to the console.

const commist = require('commist')();

commist.register('hello', () => {
  console.log('Hello, world!');
});

commist.parse(process.argv.slice(2));

Subcommand Handling

This feature allows you to handle subcommands within a command. In this example, the 'greet' command can handle 'morning' and 'evening' subcommands, printing different messages accordingly.

const commist = require('commist')();

commist.register('greet', (args) => {
  if (args[0] === 'morning') {
    console.log('Good morning!');
  } else if (args[0] === 'evening') {
    console.log('Good evening!');
  } else {
    console.log('Hello!');
  }
});

commist.parse(process.argv.slice(2));

Default Command

This feature allows you to define a default command that will be executed if no other command matches. In this example, a default command is registered to print a message.

const commist = require('commist')();

commist.register('default', () => {
  console.log('This is the default command.');
});

commist.parse(process.argv.slice(2));

Other packages similar to commist

FAQs

Package last updated on 28 Feb 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