aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cli
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2020-06-15 18:55:23 +0200
committerRenaud G <renaud@rolisteam.org>2020-06-15 18:55:23 +0200
commit6ca0d07b82c79eeb6b48463e1576ec4aec41ac31 (patch)
tree555264d3d7d9fe136bd814c3a209e7b2323e581a /cli
parent615a7e3e5d8c85ef0eedbff4fa3a29ebeded92cd (diff)
downloadOneRoll-6ca0d07b82c79eeb6b48463e1576ec4aec41ac31.tar.gz
OneRoll-6ca0d07b82c79eeb6b48463e1576ec4aec41ac31.zip
Add text output for main
Diffstat (limited to 'cli')
-rw-r--r--cli/main.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/cli/main.cpp b/cli/main.cpp
index dbeb894..0b4b2bc 100644
--- a/cli/main.cpp
+++ b/cli/main.cpp
@@ -65,7 +65,8 @@ enum EXPORTFORMAT
IMAGE,
MARKDOWN,
JSON,
- BOT
+ BOT,
+ TEXT
};
#else
enum EXPORTFORMAT
@@ -74,7 +75,8 @@ enum EXPORTFORMAT
SVG,
MARKDOWN,
JSON,
- BOT
+ BOT,
+ TEXT
};
#endif
int returnValue= 0;
@@ -282,8 +284,14 @@ int startDiceParsing(QStringList& cmds, QString& treeFile, bool withColor, EXPOR
}
int rt= 0;
+ bool in_markdown= true;
for(QString cmd : cmds)
{
+ if(cmd.startsWith('&') && format == BOT)
+ {
+ cmd= cmd.remove(0, 1);
+ in_markdown= false;
+ }
if(parser.parseLine(cmd))
{
@@ -385,7 +393,7 @@ int startDiceParsing(QStringList& cmds, QString& treeFile, bool withColor, EXPOR
{
if(allSameColor)
{
- format= MARKDOWN;
+ format= in_markdown ? MARKDOWN : TEXT;
}
else
{
@@ -417,6 +425,10 @@ int startDiceParsing(QStringList& cmds, QString& treeFile, bool withColor, EXPOR
displayMarkdown(scalarText, resultStr, array, withColor, cmdRework, error, warnings, comment,
allSameFaceCount, allSameColor);
break;
+ case TEXT:
+ displayCommandResult(scalarText, resultStr, array, false, cmdRework, error, warnings, comment,
+ allSameFaceCount, allSameColor);
+ break;
case JSON:
displayJSon(scalarText, resultStr, array, withColor, cmdRework, error, warnings, comment,
allSameFaceCount, allSameColor);
@@ -566,6 +578,14 @@ int main(int argc, char* argv[])
cmd= "help";
}
QStringList cmdList= optionParser.positionalArguments();
+
+ if(!cmdList.isEmpty())
+ {
+ if(cmdList[0].startsWith('&'))
+ {
+ colorb= false;
+ }
+ }
// cmdList << "8d10;\$1c[>6];\$1c[=1];\$2-\$3i:[>0]{\"%3 Success[%2]\"}{i:[<0]{\"Critical fail %3 [%2]\"}{\"Fail %3
// [%2]\"}}";
QJsonArray aliases;