diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-31 11:52:42 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-31 11:52:42 +0530 |
commit | fa380e1c35f403e2530bd6ffebe3a4881080a391 (patch) | |
tree | e2e7b163d2c7c9283e28c3c0ded053b3ea0fb27e /src | |
parent | 9aea7ab4daf9097225f46788fb87125c0b51076e (diff) |
msg: add option to increase verbosity
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 9 | ||||
-rw-r--r-- | src/msg.c | 4 |
2 files changed, 9 insertions, 4 deletions
@@ -33,9 +33,10 @@ msg_t *msg; void usage(char *program) { - printf("Usage: %s [-h] [-w] [-o <output>] <directory>\n", program); + printf("Usage: %s [-h] [-w] [-v] [-o <output>] <directory>\n", program); printf("\t-h : Help\n"); printf("\t-w : Watch working directory for changes\n"); + printf("\t-v : Verbose\n"); printf("\t-o <output>: Output directory\n"); printf("\t<directory>: Working directory\n"); } @@ -58,8 +59,9 @@ main(int argc, char **argv) msg = malloc(sizeof(msg_t)); msg->base_directory = "."; msg->output_directory = "dist"; + msg->verbose = false; - while ((opt = getopt(argc, argv, "o:hw")) != -1) { + while ((opt = getopt(argc, argv, "o:hvw")) != -1) { switch (opt) { case 'o': msg->output_directory = optarg; @@ -67,6 +69,9 @@ main(int argc, char **argv) case 'w': watch = true; break; + case 'v': + msg->verbose = true; + break; case 'h': default: usage(argv[0]); @@ -181,9 +181,9 @@ run(void) for (size_t i = 0; i < resources->size; i++) { ptr_wrapper_t *value = list_get(resources, i); char *path = value->ptr; - if (i < LOG_THRESHOLD) + if (i < LOG_THRESHOLD || msg->verbose) printf("\tProcessing %s\n", path); - else if (i == LOG_THRESHOLD) + else if (i == LOG_THRESHOLD && !msg->verbose) printf("\t...\n"); handle_file(path); |