[konsole] [Bug 366793] Regression in Konsole's handling of command line parameters
Jonathan Marten
bugzilla_noreply at kde.org
Tue Dec 13 20:37:55 UTC 2016
https://bugs.kde.org/show_bug.cgi?id=366793
Jonathan Marten <jjm at keelhaul.me.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jjm at keelhaul.me.uk
--- Comment #20 from Jonathan Marten <jjm at keelhaul.me.uk> ---
The cause appears to be a shortcoming in QCommandLineParser in that it has no
option syntax for "capture all the remaining arguments after this one", as was
the case for KCmdLineArgs and an option starting with '!'. Some of the
required functionality can be restored by setting the parser to not parse
options after the first non-option argument:
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -109,6 +109,7 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char*
argv[])
QSharedPointer<QCommandLineParser> parser(new QCommandLineParser);
parser->setApplicationDescription(about.shortDescription());
+
parser->setOptionsAfterPositionalArgumentsMode(QCommandLineParser::ParseAsPositionalArguments);
parser->addHelpOption();
parser->addVersionOption();
about.setupCommandLine(parser.data());
but which still fails if the first option after the command name is an option:
konsole --hold -e ls -l main.cpp => error "Unknown option 'l'."
The workaround is to ensure that the first argument is not an option:
konsole --hold -e ls main.cpp -l => works
which only works if the command accepts options after non-option arguments;
alternatively
konsole --hold -e ls -- -l main.cpp => works
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the konsole-devel
mailing list