Fix po2json usage help
The output file is an option, not a positional argument.
`opts.args` is undefined if there are no positional arguments, so that
just calling `po/po2json` crashed with
TypeError: Cannot read property 'length' of undefined
This commit is contained in:
parent
f93ccb26a8
commit
c7f610f489
1 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ function fatal(message, code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
console.log("usage: po2json [--module=template.js] input output");
|
console.log("usage: po2json [--module=template.js] [--output=output.js] input");
|
||||||
process.exit(2);
|
process.exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ var opts = stdio.getopt({
|
||||||
output: { key: "o", args: 1, description: "Output file", default: "" },
|
output: { key: "o", args: 1, description: "Output file", default: "" },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (opts.args.length != 1) {
|
if (!opts.args || opts.args.length != 1) {
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue