PARQUET-1426: [C++] Improve parquet-dump-schema usability

This commit is contained in:
Deepak Majeti authored and Wes McKinney committed 2018-10-08 10:05:29 -04:00
1 parent bcd372bff2
commit a94387d774
1 file changed
+26 -1
+26 -1
View File
@@ -15,13 +15,38 @@
// specific language governing permissions and limitations
// under the License.
#include <getopt.h>
#include <iostream>
#include "parquet/api/reader.h"
#include "parquet/api/schema.h"
int main(int argc, char** argv) {
std::string filename = argv[1];
static struct option options[] = {
{"help", no_argument, nullptr, 'h'}
};
bool help_flag = false;
int opt_index;
do {
opt_index = getopt_long(argc, argv, "h", options, nullptr);
switch (opt_index) {
case '?':
case 'h':
help_flag = true;
opt_index = -1;
break;
}
} while (opt_index != -1);
argc -= optind;
argv += optind;
if (argc != 1 || help_flag) {
std::cerr << "Usage: parquet-dump-schema [-h] [--help]"
<< " <filename>" << std::endl;
return -1;
}
std::string filename = argv[0];
try {
std::unique_ptr<parquet::ParquetFileReader> reader =