jackspeak
A very strict and proper argument parser.
USAGE
const { jack, flag, opt, list, count } = require('jackspeak')
jack({
main: myFunction,
argv: process.argv,
usage: 'foo [options] <files>',
help: `
Executes all the files and interprets their output as
TAP formatted test result data.
To parse TAP data from stdin, specify "-" as a filename.
`
flag: flag({
short: 'f',
description: `Make the flags wave`,
negate: {
short: 'F',
description: `Do not wave the flags`
},
default: true
}),
jobs: opt({
short: 'j',
description: 'number of jobs to run in parallel',
default: 1
}),
'jobs-auto': flag({
short: 'J',
alias: '--jobs=' + require('os').cpus().length
}),
timeout: opt({
short: 't',
default: +process.env.TAP_TIMEOUT || 30,
}),
'no-timeout': flag({
short: 'T',
alias: '--timeout=0'
}),
'node-arg': list(),
debug: count({
short: 'd'
})
foo: flag({
alias: ['--statements=100', '--lines=100', '--branches=100'],
}),
covlevel: opt({
alias: [
'--statements=${value}',
'--lines=${value}',
'--branches=${value}'
]
}),
100: flag({
alias: '--covlevel=100'
}),
'output-file': opt({
short: 'o',
hint: 'file',
description: `Send the raw output to the specified file.`
}),
})
Name
The inspiration for this module is yargs, which
is pirate talk themed. Yargs has all the features, and is infinitely
flexible. "Jackspeak" is the slang of the royal navy. This module
does not have all the features, and is rigid by design.