Add an option to quiet the progress indicator but not warnings

This commit is contained in:
Eric Fischer
2017-11-16 17:08:59 -08:00
parent 4dec9b43ae
commit 76d86f7d45
8 changed files with 25 additions and 11 deletions
+11 -5
View File
@@ -63,6 +63,7 @@ static int full_detail = -1;
static int min_detail = 7;
int quiet = 0;
int quiet_progress = 0;
int geometry_scale = 0;
double simplification = 1;
size_t max_tile_size = 500000;
@@ -274,7 +275,7 @@ static void merge(struct mergelist *merges, size_t nmerges, unsigned char *map,
// Count this as an 75%-accomplishment, since we already 25%-counted it
*progress += (ix.end - ix.start) * 3 / 4;
if (!quiet && 100 * *progress / *progress_max != *progress_reported) {
if (!quiet && !quiet_progress && 100 * *progress / *progress_max != *progress_reported) {
fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max);
*progress_reported = 100 * *progress / *progress_max;
}
@@ -641,7 +642,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
// Count this as a 25%-accomplishment, since we will copy again
*progress += (ix.end - ix.start) / 4;
if (!quiet && 100 * *progress / *progress_max != *progress_reported) {
if (!quiet && !quiet_progress && 100 * *progress / *progress_max != *progress_reported) {
fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max);
*progress_reported = 100 * *progress / *progress_max;
}
@@ -810,7 +811,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
// Count this as an 75%-accomplishment, since we already 25%-counted it
*progress += (ix.end - ix.start) * 3 / 4;
if (!quiet && 100 * *progress / *progress_max != *progress_reported) {
if (!quiet && !quiet_progress && 100 * *progress / *progress_max != *progress_reported) {
fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max);
*progress_reported = 100 * *progress / *progress_max;
}
@@ -1713,7 +1714,7 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
long long nprogress = 100 * ip / indices;
if (nprogress != progress) {
progress = nprogress;
if (!quiet) {
if (!quiet && !quiet_progress) {
fprintf(stderr, "Maxzoom: %lld%% \r", progress);
}
}
@@ -1809,7 +1810,7 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
long long nprogress = 100 * ip / indices;
if (nprogress != progress) {
progress = nprogress;
if (!quiet) {
if (!quiet && !quiet_progress) {
fprintf(stderr, "Base zoom/drop rate: %lld%% \r", progress);
}
}
@@ -2256,6 +2257,7 @@ int main(int argc, char **argv) {
{"Progress indicator", 0, 0, 0},
{"quiet", no_argument, 0, 'q'},
{"no-progress-indicator", no_argument, 0, 'Q'},
{"version", no_argument, 0, 'v'},
{"", 0, 0, 0},
@@ -2479,6 +2481,10 @@ int main(int argc, char **argv) {
quiet = 1;
break;
case 'Q':
quiet_progress = 1;
break;
case 'p': {
char *cp;
for (cp = optarg; *cp != '\0'; cp++) {