mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8232 from aarlt/cmdline-standard-json-from-file
Add support for reading standard-json from file
This commit is contained in:
commit
e635121bad
@ -750,7 +750,7 @@ Allowed options)",
|
||||
(
|
||||
g_argStandardJSON.c_str(),
|
||||
"Switch to Standard JSON input / output mode, ignoring all options. "
|
||||
"It reads from standard input and provides the result on the standard output."
|
||||
"It reads from standard input, if no input file was given, otherwise it reads from the provided input file. The result will be written to standard output."
|
||||
)
|
||||
(
|
||||
g_argImportAst.c_str(),
|
||||
@ -965,7 +965,22 @@ bool CommandLineInterface::processInput()
|
||||
|
||||
if (m_args.count(g_argStandardJSON))
|
||||
{
|
||||
string input = readStandardInput();
|
||||
vector<string> inputFiles;
|
||||
string jsonFile;
|
||||
if (m_args.count(g_argInputFile))
|
||||
inputFiles = m_args[g_argInputFile].as<vector<string>>();
|
||||
if (inputFiles.size() == 1)
|
||||
jsonFile = inputFiles[0];
|
||||
else if (inputFiles.size() > 1)
|
||||
{
|
||||
serr() << "If --" << g_argStandardJSON << " is used, only zero or one input files are supported." << endl;
|
||||
return false;
|
||||
}
|
||||
string input;
|
||||
if (jsonFile.empty())
|
||||
input = readStandardInput();
|
||||
else
|
||||
input = readFileAsString(jsonFile);
|
||||
StandardCompiler compiler(fileReader);
|
||||
sout() << compiler.compile(std::move(input)) << endl;
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user