-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.49..v0.2.50 changeset InfoCmd.cpp
Garret Voltz edited this page Nov 6, 2019
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/cmd/InfoCmd.cpp b/hoot-core/src/main/cpp/hoot/core/cmd/InfoCmd.cpp
index 9d93cea..8eb3f0a 100644
--- a/hoot-core/src/main/cpp/hoot/core/cmd/InfoCmd.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/cmd/InfoCmd.cpp
@@ -52,7 +52,7 @@ public:
static std::string className() { return "hoot::InfoCmd"; }
- InfoCmd() { }
+ InfoCmd() {}
virtual QString getName() const override { return "info"; }
@@ -70,17 +70,16 @@ public:
if (specifiedOpts.contains(arg) || (supportedOpts.contains(arg) && specifiedOpts.size() > 0))
{
std::cout << getHelp() << std::endl << std::endl;
- throw HootException(QString("%1 takes a single option.").arg(getName()));
+ throw IllegalArgumentException(QString("%1 takes a single option.").arg(getName()));
}
specifiedOpts.append(arg);
}
if (specifiedOpts.size() == 0)
{
std::cout << getHelp() << std::endl << std::endl;
- throw HootException(QString("%1 takes a single option.").arg(getName()));
+ throw IllegalArgumentException(QString("%1 takes a single option.").arg(getName()));
}
LOG_VARD(specifiedOpts.size());
- //assert(specifiedOpts.size() == 1);
if (specifiedOpts.contains("--config-options"))
{
@@ -103,14 +102,14 @@ public:
if (getNamesOnly && getDetails)
{
std::cout << getHelp() << std::endl << std::endl;
- throw HootException(
+ throw IllegalArgumentException(
"Only one option can be used, either --option-names or --option-details.");
}
if (args.size() > 1)
{
std::cout << getHelp() << std::endl << std::endl;
- throw HootException(
+ throw IllegalArgumentException(
QString("%1 with the --config-options option takes zero to one parameters.")
.arg(getName()));
}
@@ -130,15 +129,18 @@ public:
if (args.size() > 2)
{
std::cout << getHelp() << std::endl << std::endl;
- throw HootException(
+ throw IllegalArgumentException(
QString("%1 with the --formats option takes between zero and two parameters.")
.arg(getName()));
}
QStringList formatSubOptions;
formatSubOptions.append("--input");
- formatSubOptions.append("--output");
+ formatSubOptions.append("--input-streamable");
formatSubOptions.append("--input-bounded");
+ formatSubOptions.append("--output");
+ formatSubOptions.append("--output-streamable");
+ formatSubOptions.append("--ogr");
for (int i = 0; i < args.size(); i++)
{
const QString arg = args.at(i);
@@ -149,6 +151,13 @@ public:
}
}
+ bool displayOgrOnly = false;
+ if (args.contains("--ogr"))
+ {
+ displayOgrOnly = true;
+ args.removeAt(args.indexOf("--ogr"));
+ }
+
bool displayInputs = false;
if (args.contains("--input"))
{
@@ -156,6 +165,20 @@ public:
args.removeAt(args.indexOf("--input"));
}
+ bool displayInputsSupportingBounds = false;
+ if (args.contains("--input-bounded"))
+ {
+ displayInputsSupportingBounds = true;
+ args.removeAt(args.indexOf("--input-bounded"));
+ }
+
+ bool displayInputsSupportingStreaming = false;
+ if (args.contains("--input-streamable"))
+ {
+ displayInputsSupportingStreaming = true;
+ args.removeAt(args.indexOf("--input-streamable"));
+ }
+
bool displayOutputs = false;
if (args.contains("--output"))
{
@@ -163,23 +186,31 @@ public:
args.removeAt(args.indexOf("--output"));
}
- bool displayInputsSupportingBounds = false;
- if (args.contains("--input-bounded"))
+ bool displayOutputsSupportingStreaming = false;
+ if (args.contains("--output-streamable"))
{
- displayInputsSupportingBounds = true;
- args.removeAt(args.indexOf("--input-bounded"));
+ displayOutputsSupportingStreaming = true;
+ args.removeAt(args.indexOf("--output-streamable"));
}
- if (!displayInputs && !displayOutputs && !displayInputsSupportingBounds && args.size() == 0)
+ // If none were specified, show them all, except OGR.
+ // This is getting a little messy...maybe pass in an object with the settings instead...
+ if (!displayInputs && !displayInputsSupportingBounds && !displayInputsSupportingStreaming &&
+ !displayOutputs && !displayOutputsSupportingStreaming &&
+ (args.size() == 0 || (args.size() == 1 && displayOgrOnly)))
{
displayInputs = true;
- displayOutputs = true;
+ displayInputsSupportingStreaming = true;
displayInputsSupportingBounds = true;
+ displayOutputs = true;
+ displayOutputsSupportingStreaming = true;
}
std::cout <<
- FormatsDisplayer::display(displayInputs, displayOutputs, displayInputsSupportingBounds)
- .toStdString();
+ FormatsDisplayer::display(
+ displayInputs, displayInputsSupportingStreaming, displayInputsSupportingBounds,
+ displayOutputs, displayOutputsSupportingStreaming, displayOgrOnly)
+ .toStdString();
}
else if (specifiedOpts.contains("--languages"))
{
@@ -187,7 +218,7 @@ public:
if (args.size() != 1)
{
std::cout << getHelp() << std::endl << std::endl;
- throw HootException(
+ throw IllegalArgumentException(
QString("%1 with the --languages option takes one parameter.").arg(getName()));
}
@@ -201,14 +232,14 @@ public:
(supportedOpts.contains(arg) && specifiedOpts.size() > 0))
{
std::cout << getHelp() << std::endl << std::endl;
- throw HootException(QString("%1 takes a single option.").arg(getName()));
+ throw IllegalArgumentException(QString("%1 takes a single option.").arg(getName()));
}
specifiedOpts.append(arg);
}
if (specifiedOpts.size() == 0)
{
std::cout << getHelp() << std::endl << std::endl;
- throw HootException(
+ throw IllegalArgumentException(
QString("%1 with the --languages option takes a single option.").arg(getName()));
}
LOG_VARD(specifiedOpts.size());
@@ -253,7 +284,6 @@ public:
}
else if (specifiedOpts.contains("--cleaning-operations"))
{
- LOG_VART("test1");
std::cout << ApiEntityDisplayInfo::getDisplayInfoOps("map.cleaner.transforms").toStdString();
}
else if (specifiedOpts.contains("--conflate-post-operations"))
@@ -282,7 +312,7 @@ public:
if (args.size() != 0)
{
std::cout << getHelp() << std::endl << std::endl;
- throw HootException(
+ throw IllegalArgumentException(
QString("%1 with the --operators option takes zero parameters.").arg(getName()));
}