Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve command-line processing of gaia_db_extract #1048

Merged
merged 8 commits into from
Nov 5, 2021
10 changes: 5 additions & 5 deletions production/tools/gaia_db_extract/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using namespace gaia::common;
using namespace gaia::tools::db_extract;
using namespace std;

constexpr char c_start_string[] = "start-after";
constexpr char c_start_after_string[] = "start-after";
constexpr char c_row_limit_string[] = "row-limit";
constexpr char c_database_string[] = "database";
constexpr char c_table_string[] = "table";
Expand All @@ -24,10 +24,10 @@ constexpr char c_table_string[] = "table";
static void usage()
{
cerr << "Usage: gaia_db_extract [--" << c_database_string << "=<databasename>] [--" << c_table_string << "=<tableneme>] [--"
<< c_start_string << "=ID] [--" << c_row_limit_string << "=N]" << endl;
<< c_start_after_string << "=ID] [--" << c_row_limit_string << "=N]" << endl;
cerr << " No parameters: dump the catalog only." << endl;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean "Extracts the entire catalog" (ie all of the contents of the database)? Or does it mean that it extracts the structure of the database? Or ...?

cerr << " Else dump rows specified by " << c_database_string << "/" << c_table_string << " name, limited by "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unclear to me what is going on here. What is being reported? And is the message saying what it is doing or giving instructions of what to do?

<< c_start_string << " and " << c_row_limit_string << "." << endl;
<< c_start_after_string << " and " << c_row_limit_string << "." << endl;

// Print an empty JSON object when there is any kind of error.
cout << "{}" << endl;
Expand Down Expand Up @@ -78,12 +78,12 @@ int main(int argc, char* argv[])
// Get a parameter and value pair from the command-line.
parse_arg(argc, argv, i, key, value);

if (!key.compare(c_start_string))
if (!key.compare(c_start_after_string))
{
start_after = stoi(value);
if (start_after < 1)
{
cerr << "Illegal value for " << c_start_string << ". It must be 1 or greater." << endl;
cerr << "Illegal value for " << c_start_after_string << ". It must be 1 or greater." << endl;
usage();
}
}
Expand Down