-
Notifications
You must be signed in to change notification settings - Fork 1
/
basic.js
37 lines (33 loc) · 789 Bytes
/
basic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict'
const simpleBinHelp = require('simple-bin-help')
let 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)
const join = require('path').join
options = {
noExit: true,
help: 'basic example, path to real package.json',
minArguments: 3,
packagePath: join(__dirname, '..', 'package.json'),
onFail: function () {
console.log('fail callback, show extra info')
}
}
console.log('real package.json path')
simpleBinHelp(options)