aboutsummaryrefslogtreecommitdiffstats
path: root/solc/CommandLineInterface.cpp
diff options
context:
space:
mode:
authorAli92hm <ali92hm@gmail.com>2017-07-04 07:46:30 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-13 04:51:28 +0800
commit61dabb2f29362728b0b57a73680c23463e0b73f6 (patch)
treecfe032aaea277513c7bc237a347ac208e8e5e071 /solc/CommandLineInterface.cpp
parent487ade1635699e27cdf9700545257e14ba08cf5e (diff)
downloaddexon-solidity-61dabb2f29362728b0b57a73680c23463e0b73f6.tar
dexon-solidity-61dabb2f29362728b0b57a73680c23463e0b73f6.tar.gz
dexon-solidity-61dabb2f29362728b0b57a73680c23463e0b73f6.tar.bz2
dexon-solidity-61dabb2f29362728b0b57a73680c23463e0b73f6.tar.lz
dexon-solidity-61dabb2f29362728b0b57a73680c23463e0b73f6.tar.xz
dexon-solidity-61dabb2f29362728b0b57a73680c23463e0b73f6.tar.zst
dexon-solidity-61dabb2f29362728b0b57a73680c23463e0b73f6.zip
Added --pretty-json commandline option
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r--solc/CommandLineInterface.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 84c88b24..271511d4 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -112,10 +112,12 @@ static string const g_strSourceList = "sourceList";
static string const g_strSrcMap = "srcmap";
static string const g_strSrcMapRuntime = "srcmap-runtime";
static string const g_strStandardJSON = "standard-json";
+static string const g_strPrettyJson = "pretty-json";
static string const g_strVersion = "version";
static string const g_argAbi = g_strAbi;
static string const g_argAddStandard = g_strAddStandard;
+static string const g_argPrettyJson = g_strPrettyJson;
static string const g_argAllowPaths = g_strAllowPaths;
static string const g_argAsm = g_strAsm;
static string const g_argAsmJson = g_strAsmJson;
@@ -508,9 +510,9 @@ void CommandLineInterface::createFile(string const& _fileName, string const& _da
BOOST_THROW_EXCEPTION(FileError() << errinfo_comment("Could not write to file: " + pathName));
}
-void CommandLineInterface::createJson(string const& _fileName, Json::Value const& _json)
+void CommandLineInterface::createJson(string const& _fileName, string const& _json)
{
- createFile(boost::filesystem::basename(_fileName) + string(".json"), dev::jsonCompactPrint(_json));
+ createFile(boost::filesystem::basename(_fileName) + string(".json"), _json);
}
bool CommandLineInterface::parseArguments(int _argc, char** _argv)
@@ -546,6 +548,7 @@ Allowed options)",
"Estimated number of contract runs for optimizer tuning."
)
(g_argAddStandard.c_str(), "Add standard contracts.")
+ (g_argPrettyJson.c_str(), "Output JSON in pretty format. Currently it only works with the combined JSON output.")
(
g_argLibraries.c_str(),
po::value<vector<string>>()->value_name("libs"),
@@ -911,10 +914,12 @@ void CommandLineInterface::handleCombinedJSON()
}
}
+ string json = m_args.count(g_argPrettyJson) ? dev::jsonPrettyPrint(output) : dev::jsonCompactPrint(output);
+
if (m_args.count(g_argOutputDir))
- createJson("combined", output);
+ createJson("combined", json);
else
- cout << dev::jsonCompactPrint(output) << endl;
+ cout << json << endl;
}
void CommandLineInterface::handleAst(string const& _argStr)