Sha256: 74d3477054ba8bb346fba981f395cfd8941847babef552aa6187ec84a1a820c2

Contents?: true

Size: 1.66 KB

Versions: 8

Compression:

Stored size: 1.66 KB

Contents

#!/usr/bin/env node

var portastic = require('../');
var commander = require('commander');
var package = require('../package.json');
commander.version(package.version);

// Test if a port is closed
commander
  .command('test <port>')
  .alias('t')
  .description('Test if a port is closed or open')
  .action(function(port) {
    portastic.test(port)
      .then(function(result) {
        console.log('Port %s is %s', port, result ? 'open' : 'closed');
      });
  });

// Find available ports
commander
  .command('find <min> <max>')
  .alias('f')
  .description('Find ports that are available to use')
  .option('-r, --retrieve', 'How many ports to retrieve')
  .action(function(min, max, options) {
    portastic.find({
      min: min,
      max: max,
      retrieve: options.retrieve
    })
      .then(function(ports) {
        console.log('Ports available to use: %s', ports.join(', '));
      });
  });

// Filter a list of ports
commander
  .command('filter <ports...>')
  .alias('i')
  .description('Find ports that are open whithin a list of ports')
  .action(function(ports) {
    portastic.filter(ports)
      .then(function() {
        console.log('Ports available to use: %s', ports.join(', '));
      });
  });

// Monitor ports
commander
  .command('monitor <ports...>')
  .alias('m')
  .description('Monitor a list of ports and logs to the terminal when port state had changed')
  .action(function(ports) {
    var monitor = new portastic.Monitor(ports);
    monitor.on('open', function(port) {
      console.log('Port %s is open', port);
    });

    monitor.on('close', function(port) {
      console.log('Port %s is closed', port);
    });
  });

commander.parse(process.argv);

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
proxy_chain_rb-0.1.2 lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/bin/portastic
proxy_chain_rb-0.1.0 lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/bin/portastic
browsed-0.3.1 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic
browsed-0.3.0 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic
browsed-0.2.9 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic
browsed-0.2.8 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic
browsed-0.2.7 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic
browsed-0.2.6 lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic