aboutsummaryrefslogtreecommitdiffstats
path: root/solc/CommandLineInterface.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-08-16 23:06:56 +0800
committerchriseth <c@ethdev.com>2016-08-16 23:08:00 +0800
commitc54f31d308481bd3b54da8215938f4594121c7cd (patch)
tree309c22335fe9c6f0b7602dfe05e5460bea333c39 /solc/CommandLineInterface.cpp
parentec3298535ebe1d6602df9196b81c92d4a88b4821 (diff)
downloaddexon-solidity-c54f31d308481bd3b54da8215938f4594121c7cd.tar.gz
dexon-solidity-c54f31d308481bd3b54da8215938f4594121c7cd.tar.zst
dexon-solidity-c54f31d308481bd3b54da8215938f4594121c7cd.zip
Read from files and stdin.
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r--solc/CommandLineInterface.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index ec87b891..d1834794 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -310,21 +310,18 @@ void CommandLineInterface::handleFormal()
void CommandLineInterface::readInputFilesAndConfigureRemappings()
{
+ vector<string> inputFiles;
+ bool addStdin = false;
if (!m_args.count("input-file"))
- {
- string s;
- while (!cin.eof())
- {
- getline(cin, s);
- m_sourceCodes[g_stdinFileName].append(s + '\n');
- }
- }
+ addStdin = true;
else
for (string path: m_args["input-file"].as<vector<string>>())
{
auto eq = find(path.begin(), path.end(), '=');
if (eq != path.end())
path = string(eq + 1, path.end());
+ else if (path == "-")
+ addStdin = true;
else
{
auto infile = boost::filesystem::path(path);
@@ -345,6 +342,15 @@ void CommandLineInterface::readInputFilesAndConfigureRemappings()
}
m_allowedDirectories.push_back(boost::filesystem::path(path).remove_filename());
}
+ if (addStdin)
+ {
+ string s;
+ while (!cin.eof())
+ {
+ getline(cin, s);
+ m_sourceCodes[g_stdinFileName].append(s + '\n');
+ }
+ }
}
bool CommandLineInterface::parseLibraryOption(string const& _input)
@@ -399,9 +405,9 @@ bool CommandLineInterface::parseArguments(int _argc, char** _argv)
po::options_description desc(
R"(solc, the Solidity commandline compiler.
Usage: solc [options] [input_file...]
-Compiles the given Solidity input files (or the standard input if none given) and
-outputs the components specified in the options at standard output or in files in
-the output directory, if specified.
+Compiles the given Solidity input files (or the standard input if none given or
+"-" is used as a file name) and outputs the components specified in the options
+at standard output or in files in the output directory, if specified.
Example: solc --bin -o /tmp/solcoutput contract.sol
Allowed options)",