Skip to content

Commit

Permalink
Fix #248
Browse files Browse the repository at this point in the history
  • Loading branch information
wravery committed May 8, 2022
1 parent 681c08d commit cda3f2d
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions src/ClientGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ int main(int argc, char** argv)
po::variables_map variables;
bool showUsage = false;
bool showVersion = false;
bool buildCustom = false;
bool verbose = false;
bool noIntrospection = false;
std::string schemaFileName;
Expand Down Expand Up @@ -1264,21 +1265,28 @@ int main(int argc, char** argv)
variables);
po::notify(variables);

if (schemaFileName.empty())
{
throw po::required_option("schema");
}
else if (requestFileName.empty())
{
throw po::required_option("request");
}
else if (filenamePrefix.empty())
{
throw po::required_option("prefix");
}
else if (schemaNamespace.empty())
// If you specify any of these parameters, you must specify all four.
buildCustom = !schemaFileName.empty() || !requestFileName.empty() || !filenamePrefix.empty()
|| !schemaNamespace.empty();

if (buildCustom)
{
throw po::required_option("namespace");
if (schemaFileName.empty())
{
throw po::required_option("schema");
}
else if (requestFileName.empty())
{
throw po::required_option("request");
}
else if (filenamePrefix.empty())
{
throw po::required_option("prefix");
}
else if (schemaNamespace.empty())
{
throw po::required_option("namespace");
}
}
}
catch (const po::error& oe)
Expand All @@ -1293,7 +1301,7 @@ int main(int argc, char** argv)
outputVersion(std::cout);
return 0;
}
else if (showUsage)
else if (showUsage || !buildCustom)
{
outputUsage(std::cout, options);
return 0;
Expand Down

0 comments on commit cda3f2d

Please sign in to comment.