Added support for input from std::cin.

This commit is contained in:
Patrick Lühne 2016-05-25 12:36:45 +02:00
parent 082235eaaf
commit 441b8b0154

View File

@ -57,16 +57,12 @@ int main(int argc, char **argv)
return EXIT_SUCCESS;
}
if (!variablesMap.count("input"))
{
std::cerr << "Error: No input file specified" << std::endl << std::endl;
printHelp();
return EXIT_FAILURE;
}
try
{
const auto sasDescription = plasp::sas::Description::fromFile(variablesMap["input"].as<std::string>());
const auto sasDescription = variablesMap.count("input")
? plasp::sas::Description::fromFile(variablesMap["input"].as<std::string>())
: plasp::sas::Description::fromStream(std::cin);
const auto sasTranslator = plasp::sas::TranslatorASP(sasDescription);
sasTranslator.translate(std::cout);
}