-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(help): Showing help message on -h or --help
closes #1
- Loading branch information
Showing
5 changed files
with
94 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const simpleBinHelp = require('..') | ||
|
||
var options = { | ||
noExit: true, | ||
help: 'basic example help', | ||
minArguments: 3, | ||
pkg: {} | ||
} | ||
console.log('min arguments 3, calling with empty package') | ||
simpleBinHelp(options) | ||
|
||
options = { | ||
noExit: true, | ||
help: 'has package object', | ||
minArguments: 3, | ||
pkg: { | ||
name: 'basic-example', | ||
version: '1.0.0-dev' | ||
} | ||
} | ||
console.log('min arguments 3, calling with package') | ||
simpleBinHelp(options) | ||
|
||
options = { | ||
noExit: true, | ||
help: 'basic example, path to real package.json', | ||
minArguments: 3, | ||
packagePath: __dirname + '/../package.json', | ||
onFail: function () { | ||
console.log('fail callback, show extra info') | ||
} | ||
} | ||
console.log('real package.json path') | ||
simpleBinHelp(options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters