mirror of
https://github.com/KDE/konsole.git
synced 2026-05-01 11:15:29 -04:00
konsole -e 'man ls' should work as expected
BUG: 295648 FIXED-IN: 4.9.0
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "SessionManager.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Session.h"
|
||||
#include "ShellCommand.h"
|
||||
|
||||
using namespace Konsole;
|
||||
|
||||
@@ -375,12 +376,25 @@ Profile::Ptr Application::processProfileChangeArgs(KCmdLineArgs* args, Profile::
|
||||
|
||||
// run a custom command
|
||||
if ( args->isSet("e") ) {
|
||||
QString commandExec;
|
||||
QStringList commandArguments;
|
||||
commandArguments << args->getOption("e");
|
||||
for ( int i = 0 ; i < args->count() ; i++ )
|
||||
commandArguments << args->arg(i);
|
||||
|
||||
QString commandExec = args->getOption("e");
|
||||
// Note: KCmdLineArgs::count() return the number of arguments
|
||||
// that aren't options.
|
||||
if ( args->count() > 0 ) { // example: konsole -e man ls
|
||||
commandExec = args->getOption("e");
|
||||
|
||||
commandArguments << commandExec;
|
||||
for ( int i = 0 ; i < args->count() ; i++ )
|
||||
commandArguments << args->arg(i);
|
||||
|
||||
} else { // example: konsole -e "man ls"
|
||||
ShellCommand shellCommand(args->getOption("e"));
|
||||
|
||||
commandExec = shellCommand.command();
|
||||
commandArguments = shellCommand.arguments();
|
||||
}
|
||||
|
||||
if (commandExec.startsWith(QLatin1String("./")))
|
||||
commandExec = QDir::currentPath() + commandExec.mid(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user