diff -r c80878da618c -r 9b541d22d649 src/cline.c --- a/src/cline.c Sun Jun 28 14:29:39 2026 +0200 +++ b/src/cline.c Sun Jun 28 15:57:44 2026 +0200 @@ -45,6 +45,8 @@ "\n One of: ignore low medium high" "\n -c - Count non-whitespace characters instead of lines" "\n -d - Report only directory sums" + "\n -D - Excludes the directory at the specified " + "\n -D - Excludes all directories with the given " "\n -E - Excludes any line matching the " "\n -e - Excludes lines between and " "\n You may use these options multiple times" @@ -116,7 +118,7 @@ for (int t = 1 ; t < argc ; t++) { - int argflags = checkArgument(argv[t], "hsSrRmvVbeEicd"); + int argflags = checkArgument(argv[t], "hsSrRmvVbeEicdD"); int paropt = 0; /* h */ @@ -234,6 +236,16 @@ settings->dirsOnly = true; } } + /* D */ + if ((argflags & 16384) > 0) { + t++; + if (!checkParamOpt(&paropt) || t >= argc) { + return exit_with_help(settings, 1); + } + // TODO: normalize argument before adding to dir list + // this makes it more efficient to compare dir names later + add_string(settings->excludeDirs, argv[t]); + } if (argflags == 0) { /* SHORTCUTS */ if (strcmp(argv[t], "--exclude-cstyle-comments") == 0) {