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

headquarters

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

headquarters

Issue commands to your program while it is running.

  • 0.2.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Headquarters

Issue commands to your program while it is running.

Installation

$ npm install --save headquarters
var hq = require('headquarters');

Methods

command

hq.command(name, action);

Sets a command.

Parameters

  • name the name of the command (string)
  • action called whe the command is issued (function)

Type your command name in the console as your program is running followed by any additional parameters. The action function for that command will then be executed, with the additional parameters passed into the first argument of the function as an array.

raw

hq.raw(action);

Specify what to do with raw input (i.e. issue a command with no command name).

Parameters

  • action called when raw input (input with no established command) is entered (function)

The input is broken up by spaces, put into an array, and then passed into the action callback as a single parameter. Named commands can still be set and executed normally.

Example

var hq = require('headquarters');

hq.command('say', function (params) {
	console.log(params.join(' '));
});

In the command line, start your program:

$ node my_program.js

Then use your custom command:

say hello world!

Profit:

hello world!

Pre-existing Commands

Commands that are already built into headquarters:

  • 'quit' stops your process from running
  • 'curl' retrieves a response from a url argument

FAQs

Package last updated on 03 Apr 2015

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