From: Jani Nikula Date: Sat, 14 Oct 2017 13:16:06 +0000 (+0300) Subject: cli: add support for --no- prefixed boolean and keyword flag arguments X-Git-Tag: 0.26_rc0~28 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=39abd3b5226fef99de1adaa2e8f6b1ba8480c5f5;hp=39abd3b5226fef99de1adaa2e8f6b1ba8480c5f5 cli: add support for --no- prefixed boolean and keyword flag arguments Add transparent support for negating boolean and keyword flag arguments using --no-argument style on the command line. That is, if the option description contains a boolean or a keyword flag argument named "argument", --no-argument will match and negate it. For boolean arguments this obviously means the logical NOT. For keyword flag arguments this means bitwise AND of the bitwise NOT, i.e. masking out the specified bits instead of OR'ing them in. For example, you can use --no-exclude instead of --exclude=false in notmuch show. If we had keyword flag arguments with some flags defaulting to on, say --include=tags in notmuch dump/restore, this would allow --no-include=tags to switch that off while not affecting other flags. As a curiosity, you should be able to warp your brain using --no-exclude=true meaning false and --no-exclude=false meaning true if you wish. Specifying both "argument" and "no-argument" style arguments in the same option description should be avoided. In this case, --no-argument would match whichever is specified first, and --argument would only match "argument". ---