From ad30c1a528d93566db72a058cda1992e986210c0 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Fri, 11 Jun 2021 20:27:50 +0000 Subject: exec-cmd: show: handle argument '--no-color' --- src/exec-cmd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/exec-cmd.c b/src/exec-cmd.c index 4ec1c10..0751d29 100644 --- a/src/exec-cmd.c +++ b/src/exec-cmd.c @@ -424,18 +424,20 @@ int cmd_version(int argc, char *argv[]) int cmd_showtree(int argc, char *argv[]) { - const char description[] = "[-c] [passname]\n"; - int flag_copy = 0; + const char description[] = "[-cC] [passname]\n"; + int flag_copy = 0, flag_color = 1; int retval = 0, result; char *path; const struct option long_options[] = { {"copy", no_argument, NULL, 'c'}, + {"no-color", no_argument, NULL, 'C'}, {NULL, 0, NULL, 0} }; - while((result = getopt_long(argc, argv, "c", long_options, NULL)) != -1) { + while((result = getopt_long(argc, argv, "cC", long_options, NULL)) != -1) { switch(result) { case 'c': { flag_copy = 1; break; } + case 'C': { flag_color = 0; break; } default: usageprint("%s", description); } } @@ -467,7 +469,7 @@ int cmd_showtree(int argc, char *argv[]) printf("Password Manager\n"); else printf("Password Manager/%s\n", path); - tree(path, ""); + tree(path, "", flag_color); } else if(result == F_ISFILE) { -- cgit v1.2.3-18-g5258