https://bugs.kde.org/show_bug.cgi?id=366793

Jonathan Marten <j...@keelhaul.me.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |j...@keelhaul.me.uk

--- Comment #20 from Jonathan Marten <j...@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 watching all bug changes.

Reply via email to