Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Create nice looking shell applications in minutes with a Connect inspired API.
var spawn = require('child_process').spawn,
shell = require('shell'),
app = new shell.Shell();
app.configure(function(){
app.use( shell.history({shell: app}) );
app.use( shell.completer({shell: app}) );
app.use( shell.help({shell: app, introduction: true}) );
});
app.on('exit', function(){
if(app.server){ app.server.kill(); }
if(app.client){ app.client.quit(); }
});
app.cmd('start', 'Start the redis server', function(req, res, next){
app.server = spawn('redis-server', [__dirname+'/redis.conf']);
next();
});
app.cmd('keys :pattern', 'Find keys', function(req, res, next){
if(!app.client){
app.client = require('redis').createClient();
}
app.client.keys(req.params.pattern, function(err, keys){
if(err){ return res.styles.red(err.message), next(); }
res.cyan(keys.join('\n')||'no keys');
next();
});
});
`npm install shell`
var app = new shell.Shell();
app.configure(function(){
app.use( shell.history({shell: app}) );
app.use( shell.completer({shell: app}) );
app.use( shell.help({shell: app, introduction: true}) );
});
The constructor shell.Shell
take an optional object. options are
Like with Express, app.configure
allows the customization of plugins for different environments (however, it is not yet implemented) while app.use
register plugins.
A route is made of a command pattern, an optional description and one or more route specific middleware.
Middlewares recieve three parameters, a request object, a response object and a function.
The request object contains the following properties:
The response object inherit from styles which contains various utility functions for printing, coloring and bolding.
Persist command history between multiple sessions. Options passed during creation are:
process.cwd()+'/.node_shell'
Provide tab completion. Options passed during creation are:
Display help when use type "help" or when he press enter
on empty prompt. Command help is only displayed if a description was provided during the command registration. Additionnaly, a new shell.help()
function is made available. Options passed during creation are:
FAQs
Command line arguments parser and stringifier
The npm package shell receives a total of 5,564 weekly downloads. As such, shell popularity was classified as popular.
We found that shell demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.