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

commander-rxjs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commander-rxjs

A simple adapter to easily use RxJS with commander.

  • 0.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

commander-rxjs

[![](https://img.shields.io/npm/v/commander-rxjs.svg?style=flat)](https://www.npmjs.com/package/commander-rxjs) [![](https://img.shields.io/travis/nickbreaton/commander-rxjs/master.svg?style=flat)](https://travis-ci.org/nickbreaton/commander-rxjs) [![](https://img.shields.io/codecov/c/github/nickbreaton/commander-rxjs.svg?style=flat)](https://codecov.io/gh/nickbreaton/commander-rxjs)

A simple adapter to easily use RxJS with commander.

Installation

$ npm install commander-rxjs

Note: commander and rxjs are both specified as peer dependencies. You must install them alongside commander-rxjs.

$ npm install commander rxjs

Convert commands to observables

commander-rxjs provides a .observe() function to convert commands an RxJS observable.

Note: The .observe() can be used any place commander's .action(cb) function can be used.

import program from 'commander-rxjs';

program
  .command('order [item]')       
  .option('--two-day-shipping')  
  .observe()                     
  .do(command => {               
    console.log(command.args, command.options);     
    // --> { item: "JavaScript Stickers" }
    // --> { twoDayShipping: true }
  })
  .subscribe();                  

// INPUT: amazon-cli order "JavaScript Stickers" --two-day-shipping
program
  .parse(process.argv)

Examples

Be sure to checkout all of the examples.

Then can easily be run by npm run example:[example-name].

FAQs

Package last updated on 06 Dec 2016

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