From e93952802113a2f86ddeb86e99e360a7a34b90cc Mon Sep 17 00:00:00 2001 From: berteh Date: Mon, 14 Sep 2015 10:35:18 +0200 Subject: [PATCH] detect missing argument --- scribus/scribusapp.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scribus/scribusapp.cpp b/scribus/scribusapp.cpp index 6a43590..a1f4c52 100644 --- a/scribus/scribusapp.cpp +++ b/scribus/scribusapp.cpp @@ -173,9 +173,15 @@ void ScribusQApp::parseCommandLine() arg = args[argi]; if (arg == ARG_SCRIPTARG || arg == ARG_SCRIPTARG_SHORT) { //needs to be first to give precedence to script argument name over scribus' options - pythonScriptArgs.append(args[++argi]); // arg name - if (!args[argi+1].startsWith("-")) { // arg value - pythonScriptArgs.append( QFile::decodeName(args[++argi].toLocal8Bit()) ); + if (++argi [value]").arg(arg).toLocal8Bit().data() << std::endl; + showUsage(); + std::exit(EXIT_FAILURE); + } + if (++argi").arg(ARG_PYTHONSCRIPT).arg(tr("filename"))), tr("Run filename in Python scripter") ); - printArgLine(ts, ARG_SCRIPTARG_SHORT, qPrintable(QString("%1 <%2> [%3]").arg(ARG_SCRIPTARG).arg(tr("name")).arg(tr("value"))), tr("Argument passed on to python script, with an optional value, no effect without -py") ); + printArgLine(ts, ARG_SCRIPTARG_SHORT, qPrintable(QString("%1 <%2> [%3]").arg(ARG_SCRIPTARG).arg(tr("argument")).arg(tr("value"))), tr("Argument passed on to python script, with an optional value, no effect without -py") ); printArgLine(ts, ARG_NOGUI_SHORT, ARG_NOGUI, tr("Do not start GUI") ); ts << (QString(" %1").arg(CMD_OPTIONS_END,-39)) << tr("Explicit end of command line options"); endl(ts);