in src/apps/filters/h3ToComponents.c [105:136]
int main(int argc, char* argv[]) {
Arg helpArg = ARG_HELP;
Arg verboseArg = {.names = {"-v", "--verbose"},
.helpText = "Verbose output mode."};
DEFINE_INDEX_ARG(index, indexArg);
const int numArgs = 3;
Arg* args[] = {&helpArg, &verboseArg, &indexArg};
if (parseArgs(argc, argv, numArgs, args, &helpArg,
"Converts H3 indexes to component parts")) {
return helpArg.found ? 0 : 1;
}
if (indexArg.found) {
doCell(index, verboseArg.found);
} else {
// process the indexes on stdin
char buff[BUFF_SIZE];
while (1) {
// get an index from stdin
if (!fgets(buff, BUFF_SIZE, stdin)) {
if (feof(stdin))
break;
else
error("reading H3 index from stdin");
}
H3Index h3 = H3_EXPORT(stringToH3)(buff);
doCell(h3, verboseArg.found);
}
}
}