From c7f610f489a43941f6b472dc5ed7f3fb0a526428 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 26 Dec 2020 08:08:46 +0100 Subject: [PATCH] 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 --- po/po2json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/po2json b/po/po2json index d521f30..690d7d0 100755 --- a/po/po2json +++ b/po/po2json @@ -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(); }