Skip to content

Commit

Permalink
Display help on invalid arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
arvind-agarwal committed Dec 10, 2014
1 parent fad79ab commit 1014402
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (C) 2014 Zapty Inc, Arvind Agarwal & the Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
14 changes: 12 additions & 2 deletions bin/forever-service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ platforms.get(function(err, platform){
console.log('forever-service version '+require('../package.json').version+'\n');
if(err || !platform){
console.error('This platform is not yet supported by forever-service');
console.error('To help us add this platform, please contibute to https://github.com/zapty/forever-service');
console.error('To help us add this platform, please contibute to https://github.com/zapty/forever-service\n');
return;
}

Expand Down Expand Up @@ -143,6 +143,16 @@ platforms.get(function(err, platform){
});


program.parse(process.argv);

var result = program.parse(process.argv);
if(!(result.args && result.args.length > 1 && result.args[1] && typeof result.args[1]==='object')){
//If command line arguments are invalid display help
console.error("Invalid arguments!");
program.outputHelp();
console.log(' Command help:\n')
console.log(' forever-service install --help');
console.log(' forever-service delete --help\n');
}

});

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "forever-service",
"version": "0.4.0",
"version": "0.4.1",
"preferGlobal": "true",
"description": "Provision node script as a service via forever, allowing it to automatically start on boot, working across various Linux distros and OS",
"main": "lib/api.js",
Expand Down

0 comments on commit 1014402

Please sign in to comment.