@@ -1224,6 +1224,7 @@ int main(int argc, char** argv)
1224
1224
po::variables_map variables;
1225
1225
bool showUsage = false ;
1226
1226
bool showVersion = false ;
1227
+ bool buildCustom = false ;
1227
1228
bool verbose = false ;
1228
1229
bool noIntrospection = false ;
1229
1230
std::string schemaFileName;
@@ -1264,21 +1265,28 @@ int main(int argc, char** argv)
1264
1265
variables);
1265
1266
po::notify (variables);
1266
1267
1267
- if (schemaFileName.empty ())
1268
- {
1269
- throw po::required_option (" schema" );
1270
- }
1271
- else if (requestFileName.empty ())
1272
- {
1273
- throw po::required_option (" request" );
1274
- }
1275
- else if (filenamePrefix.empty ())
1276
- {
1277
- throw po::required_option (" prefix" );
1278
- }
1279
- else if (schemaNamespace.empty ())
1268
+ // If you specify any of these parameters, you must specify all four.
1269
+ buildCustom = !schemaFileName.empty () || !requestFileName.empty () || !filenamePrefix.empty ()
1270
+ || !schemaNamespace.empty ();
1271
+
1272
+ if (buildCustom)
1280
1273
{
1281
- throw po::required_option (" namespace" );
1274
+ if (schemaFileName.empty ())
1275
+ {
1276
+ throw po::required_option (" schema" );
1277
+ }
1278
+ else if (requestFileName.empty ())
1279
+ {
1280
+ throw po::required_option (" request" );
1281
+ }
1282
+ else if (filenamePrefix.empty ())
1283
+ {
1284
+ throw po::required_option (" prefix" );
1285
+ }
1286
+ else if (schemaNamespace.empty ())
1287
+ {
1288
+ throw po::required_option (" namespace" );
1289
+ }
1282
1290
}
1283
1291
}
1284
1292
catch (const po::error& oe)
@@ -1293,7 +1301,7 @@ int main(int argc, char** argv)
1293
1301
outputVersion (std::cout);
1294
1302
return 0 ;
1295
1303
}
1296
- else if (showUsage)
1304
+ else if (showUsage || !buildCustom )
1297
1305
{
1298
1306
outputUsage (std::cout, options);
1299
1307
return 0 ;
0 commit comments