npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gogo-shell

v0.0.5

Published

A Node wrapper for sending Gogo commands to an OSGi environment

Downloads

1,012

Readme

gogo-shell Build Status Coverage Status

A Node wrapper for sending Gogo commands to an OSGi environment

Install

$ npm install --save gogo-shell

Usage

Note: a Gogo shell must be running before invoking the connect method, otherwise a connection error will be thrown.

var GogoShell = require('gogo-shell');

var gogoShell = new GogoShell();

var config = {
    port: 11311
};

gogoShell.connect(config)
    .then(function() {
        return gogoShell.sendCommand('lb');
    })
    .then(function(data) {
        // Do something with response data

        gogoShell.end();
    });

API

GogoShell is an instance of net.Socket and inherits all it's properties, methods, and events.

new GogoShell([options])

options

Type: object

The GogoShell constructor can also be passed the same configuration options as the net.Socket constructor.

debug

type: boolean

If set to true, prints all commands sent to the server, and all response data from the server to stdout.

examples

var GogoShell = require('gogo-shell');

var gogoShell = new GogoShell({
    debug: true
});

connect([options])

Connects to a TCP server which allows you to send Gogo commands to an OSGi environment. Returns a Promise which resolves when the server is ready to receive commands.

options

Type: object

host

Type: string Default: 127.0.0.1

port

Type: number Required: true

See socket.connect method for other options and their default values.

examples

var GogoShell = require('gogo-shell');

var gogoShell = new GogoShell();

var config = {
    port: 11311
};

gogoShell.connect(config)
    .then(function() {
        // gogoShell.sendCommand(...);
    });

help([command])

Returns Promise that resolves with array of available commands, or object literal containing information on specified command.

command

Type: string

The Gogo command to retieve help info for.

examples

gogoShell.help()
    .then(function(data) {
        // data = array of available commands
    });
gogoShell.help('install')
    .then(function(data) {
        // data = object literal containing api information for specified command
    });

sendCommand(command, [options])

Sends Gogo command to an OSGi environment. Returns a Promise that resolves with the response data.

command

Type: string

The Gogo command that will be sent to the OSGi environment.

options

Type: string

Additional parameters, flags, and options that will be joined with the command argument.

examples

gogoShell.sendCommand('lb', '-s')
    .then(function(data) {
        // data = list of installed bundles with symbolic name
    });

Chaining commands.

var GogoShell = require('gogo-shell');

var gogoShell = new GogoShell();

var config = {
    port: 11311
};

gogoShell.connect(config)
    .then(function() {
        return gogoShell.sendCommand('lb');
    })
    .then(function(data) {
        // data = response from 'lb'

        return gogoShell.sendCommand('another command');
    })
    .then(function(data) {
        // data = response from 'another command'

        // Using socket.end for closing connection, otherwise Node process wouldn't end
        gogoShell.end();
    });

MIT