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:
Martin Pitt 2020-12-26 08:08:46 +01:00 committed by Matej Marusak
parent f93ccb26a8
commit c7f610f489

View file

@ -6,7 +6,7 @@ function fatal(message, code) {
}
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);
}
@ -29,7 +29,7 @@ var opts = stdio.getopt({
output: { key: "o", args: 1, description: "Output file", default: "" },
});
if (opts.args.length != 1) {
if (!opts.args || opts.args.length != 1) {
usage();
}