Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Adding a version command to get the version of penelope installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
tizzo committed May 30, 2014
1 parent 576dc47 commit 217cc5c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
8 changes: 8 additions & 0 deletions bin/penelope
Expand Up @@ -16,6 +16,9 @@ argv = yargs
.default('help', false)
.describe('help', 'Display this help text.')
.alias('help', 'h')
.describe('version', 'Print the version number')
.alias('version', 'v')
.default('version', false)
.alias('command', 'c')
.describe('command', 'A command to run as a child.')
.describe('name', 'If present, a name for the command in the same position. The first --name will name the first --command.')
Expand All @@ -28,6 +31,11 @@ if (argv.help) {
process.exit(0);
}

if (argv.version) {
console.log(require('../package').version);
process.exit(0);
}

var commands = argv.command;
if (typeof argv.command === 'string') {
commands = [ argv.command ];
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "lepew-penelope",
"version": "0.0.2",
"version": "0.0.3",
"description": "A simple task wrapper that produces json event streams from the wrapped sub-processes.",
"main": "index.js",
"bin": {
Expand Down
12 changes: 11 additions & 1 deletion test/testCommandLine.js
Expand Up @@ -11,7 +11,7 @@ var penelopeBinPath = path.join(__dirname, '..', 'bin', 'penelope');

describe('penelope executable', function() {
it('should display helptext', function(done) {
var stream = run(path.join(__dirname, '..', 'bin', 'penelope'), ['-h']);
var stream = run(penelopeBinPath, ['-h']);
var output = '';
stream.stderr.pipe(es.through(
function(data) {
Expand All @@ -24,6 +24,16 @@ describe('penelope executable', function() {
))
.pipe(process.stdout);
});
it ('should print its own version number', function(done) {
var stream = run(penelopeBinPath, ['-v']);
stream
.pipe(es.split())
.pipe(es.writeArray(function(error, array) {
should.exist(array[0]);
array[0].should.equal(require('../package').version);
done(error);
}));
});
it('should run a signle command', function(done) {
var args = [
'-c', beeperPath
Expand Down

0 comments on commit 217cc5c

Please sign in to comment.