Fix cli parsing

This commit is contained in:
Julien Wadel 2021-10-06 18:32:27 +02:00
parent 36505b9d60
commit b82f6fd13b
15 changed files with 21 additions and 39 deletions

View file

@ -966,8 +966,7 @@ Server url ikke konfigureret.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -966,8 +966,7 @@ Server URL ist nicht konfiguriert.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -956,8 +956,7 @@ URL del servidor no configurada.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -966,9 +966,8 @@ URL du serveur non configurée.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation>Les messages éphémères ne sont disponibles que pour une conversation définie en mode conférence!</translation>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation>Les messages éphémères ne sont disponibles que pour une conversation définie en mode conférence&#x202f;!</translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>
<message>

View file

@ -533,28 +533,24 @@ A kiszolgáló URL-je nincs konfigurálva.</translation>
<source>nMinute</source>
<translation>
<numerusform>%1 perc</numerusform>
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<source>nHour</source>
<translation>
<numerusform>%1 óra</numerusform>
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<source>nDay</source>
<translation>
<numerusform>%1 nap</numerusform>
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<source>nWeek</source>
<translation>
<numerusform>%1 hét</numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
@ -965,8 +961,7 @@ A kiszolgáló URL-je nincs konfigurálva.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation>Az elmúló üzenetet csak a konferencia alapú csevegőszoba támogatja!</translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -966,8 +966,7 @@ URL del server non configurato.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -961,8 +961,7 @@
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -971,8 +971,7 @@ Nesukonfigūruotas serverio url.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -966,8 +966,7 @@ URL do servidor não configurado.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -971,8 +971,7 @@
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -966,8 +966,7 @@ Serverwebbadressen är inte konfigurerad.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -961,8 +961,7 @@ Sunucu url&apos;si yapılandırılmadı.</translation>
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -971,8 +971,7 @@
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -961,8 +961,7 @@
</message>
<message>
<source>ephemeralNotInConference!</source>
<extracomment>&apos;
Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<extracomment>&apos;Ephemeral message is only supported in conference based chat room!&apos;</extracomment>
<translation type="unfinished"></translation>
<extra-Context>Warning about not being in conference based chat room.</extra-Context>
</message>

View file

@ -409,7 +409,7 @@ QString Cli::Command::getFunctionSyntax () const {
// FIXME: Do not accept args without value like: cmd toto.
// In the future `toto` could be a boolean argument.
QRegExp Cli::mRegExpArgs("(?:(?:([\\w-]+)\\s*)=\\s*(?:\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"|([^\\s]+)\\s*))");
QRegExp Cli::mRegExpFunctionName("^\\s*([A-Z-]+)\\s*");
QRegExp Cli::mRegExpFunctionName("^\\s*([a-z-]+)\\s*");
QMap<QString, Cli::Command> Cli::mCommands = {
createCommand("show", QT_TR_NOOP("showFunctionDescription"), cliShow, QHash<QString, Argument>(), true),
@ -480,7 +480,7 @@ void Cli::executeCommand (const QString &command, CommandFormat *format) {
if (format)
*format = UriFormat;
qInfo() << QStringLiteral("Detecting uri command: `%1`...").arg(command);
QString functionName, alternativeCommand = command;
QString functionName;
if( address) {
functionName = Utils::coreStringToAppString(address->getHeader("method")).isEmpty()
? QStringLiteral("call")
@ -498,7 +498,7 @@ void Cli::executeCommand (const QString &command, CommandFormat *format) {
functionName = "call";
}
}
functionName = functionName.toUpper();
functionName = functionName.toLower();
if( functionName.isEmpty()){
qWarning() << QStringLiteral("There is no method set in `%1`.").arg(command);
return;
@ -539,13 +539,13 @@ pair<QString, Cli::Command> Cli::createCommand (
const QHash<QString, Argument> &argsScheme,
const bool &genericArguments
) {
return { functionName.toUpper(), Cli::Command(functionName.toUpper(), functionDescription, function, argsScheme, genericArguments) };
return { functionName.toLower(), Cli::Command(functionName.toLower(), functionDescription, function, argsScheme, genericArguments) };
}
// -----------------------------------------------------------------------------
QString Cli::parseFunctionName (const QString &command) {
mRegExpFunctionName.indexIn(command.toUpper());
mRegExpFunctionName.indexIn(command.toLower());
if (mRegExpFunctionName.pos(1) == -1) {
qWarning() << QStringLiteral("Unable to parse function name of command: `%1`.").arg(command);
return QString("");
@ -566,7 +566,7 @@ QHash<QString, QString> Cli::parseArgs (const QString &command) {
QHash<QString, QString> args;
int pos = 0;
while ((pos = mRegExpArgs.indexIn(command.toUpper(), pos)) != -1) {
while ((pos = mRegExpArgs.indexIn(command.toLower(), pos)) != -1) {
pos += mRegExpArgs.matchedLength();
args[mRegExpArgs.cap(1)] = (mRegExpArgs.cap(2).isEmpty() ? mRegExpArgs.cap(3) : mRegExpArgs.cap(2));
}