diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2018-12-06 09:56:45 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2019-01-07 16:58:06 +0100 |
commit | 42abbf53463cbbdcd319063fcbfb91cf6ed5bdc5 (patch) | |
tree | a787439c222045a47484e30d6752c71635c41efc /src/args.c | |
parent | 9300e9154c5f70aa6fb858452f0c3563d100850d (diff) | |
download | calcurse-42abbf53463cbbdcd319063fcbfb91cf6ed5bdc5.tar.gz calcurse-42abbf53463cbbdcd319063fcbfb91cf6ed5bdc5.zip |
Filter option: invert
New filter option: --filter-invert. When present it inverts (negates)
the other filter options combined. This is mostly useful with the -G
option (with -Q the output is limited by the query range (day range)).
The ouput from "calcurse -G <filter options>" is the (set) complement of
"calcurse -G <filter options> --filter-invert". Here <filter options>
may be any combination of filter options.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/args.c')
-rw-r--r-- | src/args.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -54,7 +54,8 @@ enum { /* Long options */ enum { - OPT_FILTER_TYPE = 1000, + OPT_FILTER_INVERT = 1000, + OPT_FILTER_TYPE, OPT_FILTER_HASH, OPT_FILTER_PATTERN, OPT_FILTER_START_FROM, @@ -410,7 +411,7 @@ int parse_args(int argc, char **argv) int range = 0; int limit = INT_MAX; /* Filters */ - struct item_filter filter = { 0, NULL, NULL, -1, -1, -1, -1, 0, 0, 0 }; + struct item_filter filter = { 0, 0, NULL, NULL, -1, -1, -1, -1, 0, 0, 0 }; /* Format strings */ const char *fmt_apt = NULL; const char *fmt_rapt = NULL; @@ -457,6 +458,7 @@ int parse_args(int argc, char **argv) {"quiet", no_argument, NULL, 'q'}, {"query", optional_argument, NULL, 'Q'}, + {"filter-invert", no_argument, NULL, OPT_FILTER_INVERT}, {"filter-type", required_argument, NULL, OPT_FILTER_TYPE}, {"filter-hash", required_argument, NULL, OPT_FILTER_HASH}, {"filter-pattern", required_argument, NULL, OPT_FILTER_PATTERN}, @@ -623,6 +625,10 @@ int parse_args(int argc, char **argv) case 'Q': query = 1; break; + case OPT_FILTER_INVERT: + filter.invert = !filter.invert; + filter_opt = 1; + break; case OPT_FILTER_TYPE: filter.type_mask = parse_type_mask(optarg); EXIT_IF(filter.type_mask == 0, |