aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/main.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/cli/main.cpp b/cli/main.cpp
index 1b9fdad..462c826 100644
--- a/cli/main.cpp
+++ b/cli/main.cpp
@@ -117,10 +117,13 @@ QString diceToText(ExportedDiceResult& dice,bool highlight,bool homogeneous)
return resultGlobal.join(' ');
}
-void startDiceParsing(QString& cmd,QString& treeFile,bool highlight)
+void startDiceParsing(QStringList& cmds,QString& treeFile,bool highlight)
{
DiceParser* parser = new DiceParser();
+ for(QString cmd : cmds)
+ {
+
if(parser->parseLine(cmd))
{
//
@@ -156,6 +159,10 @@ void startDiceParsing(QString& cmd,QString& treeFile,bool highlight)
{
str = parser->getStringResult();
}
+ if(!parser->getComment().isEmpty())
+ {
+ out << "\033[1m" <<parser->getComment()<< "\033[0m\n";
+ }
out << str << "\n";
if(!treeFile.isEmpty())
{
@@ -166,6 +173,7 @@ void startDiceParsing(QString& cmd,QString& treeFile,bool highlight)
{
out << parser->humanReadableError()<< "\n";;
}
+ }
}
void usage()
@@ -261,18 +269,14 @@ int main(int argc, char *argv[])
QStringList cmdList = optionParser.positionalArguments();
// qDebug()<< "rest"<< cmdList;
- if(!cmdList.isEmpty())
- {
- cmd = cmdList.first();
- }
- if(!cmd.isEmpty())
- {
- startDiceParsing(cmd,dotFileStr,colorb);
+
+ startDiceParsing(cmdList,dotFileStr,colorb);
if(optionParser.isSet(help))
{
usage();
}
- }
+
+
return 0;
}