From 3bf6f11939844b2daa7c6555c5c3d828095308d5 Mon Sep 17 00:00:00 2001 From: Renaud Guezennec Date: Wed, 23 Oct 2024 15:44:12 +0200 Subject: changes --- src/bin/cli/main.cpp | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) (limited to 'src/bin/cli') diff --git a/src/bin/cli/main.cpp b/src/bin/cli/main.cpp index 9ec128a..2864c27 100644 --- a/src/bin/cli/main.cpp +++ b/src/bin/cli/main.cpp @@ -336,7 +336,8 @@ int startDiceParsing(QStringList& cmds, bool withColor, QString baseColor, EXPOR allSameColor= true; QString colorP; json= parser.resultAsJSon( - [&colorP, &allSameColor](const QString& value, const QString& color, bool) { + [&colorP, &allSameColor](const QString& value, const QString& color, bool) + { if(colorP.isNull()) colorP= color; else if(colorP != color) @@ -348,25 +349,27 @@ int startDiceParsing(QStringList& cmds, bool withColor, QString baseColor, EXPOR if(!allSameColor) { - json= parser.resultAsJSon([](const QString& value, const QString& color, bool highlight) { - QString result= value; - bool hasColor= !color.isEmpty(); - QString style; - if(hasColor) + json= parser.resultAsJSon( + [](const QString& value, const QString& color, bool highlight) { - style+= QStringLiteral("fill=\"%1\" ").arg(color); - } - if(highlight) - { - if(style.isEmpty()) - style+= QStringLiteral("fill=\"%1\" ") - .arg("red"); // default color must get the value from the setting object - style+= QStringLiteral("font-weight=\"bold\" "); - } - if(!style.isEmpty()) - result= QString("%1").arg(value).arg(style); - return result; - }); + QString result= value; + bool hasColor= !color.isEmpty(); + QString style; + if(hasColor) + { + style+= QStringLiteral("fill=\"%1\" ").arg(color); + } + if(highlight) + { + if(style.isEmpty()) + style+= QStringLiteral("fill=\"%1\" ") + .arg("red"); // default color must get the value from the setting object + style+= QStringLiteral("font-weight=\"bold\" "); + } + if(!style.isEmpty()) + result= QString("%1").arg(value).arg(style); + return result; + }); } } else if(TERMINAL == format) @@ -374,7 +377,8 @@ int startDiceParsing(QStringList& cmds, bool withColor, QString baseColor, EXPOR allSameColor= true; QString colorP; json= parser.resultAsJSon( - [&colorP, &allSameColor, &baseColor](const QString& result, const QString& color, bool hightlight) { + [&colorP, &allSameColor, &baseColor](const QString& result, const QString& color, bool hightlight) + { auto trueColor= color; if(color.isEmpty()) trueColor= baseColor; @@ -590,6 +594,12 @@ int main(int argc, char* argv[]) cmd= "help"; } QStringList cmdList= optionParser.positionalArguments(); + for(auto& cmd : cmdList) + cmd= QUrl::fromPercentEncoding(cmd.toUtf8()); + + qDebug() << "cmdList" << cmdList; + // cmdList << "(1)-1d4e4mk00;300;[$1\u0004$3]k1;0100;200;300;[$1,$2,$3]k1TK\u0004;$1+$1;$2i:[<1]{1}{0}"; + cmdList << "1d4e4mk00;300;100;[$1,$2,$3]k1TK\u0004"; QJsonArray aliases; if(optionParser.isSet(alias)) -- cgit v1.2.3-70-g09d2