summaryrefslogtreecommitdiffstats
path: root/command-line-arguments.h
AgeCommit message (Collapse)Author
2019-06-14cli: run uncrustifyuncrustify
This is the result of running $ uncrustify --replace --config devel/uncrustify.cfg *.c *.h in the top level source directory
2017-12-29cli: some keyword options can be supplied with no argumentDaniel Kahn Gillmor
We might change some notmuch command line tools that used to be booleans into keyword arguments. In that case, there are some legacy tools that will expect to be able to do "notmuch foo --bar" instead of "notmuch foo --bar=baz". This patch makes it possible to support that older API, while providing a warning and an encouragement to upgrade.
2017-11-08cli: allow empty strings for notmuch insert --folder argumentJani Nikula
Now that it's easy to add argument specific modifiers in opt descriptions, add a new .allow_empty field to allow empty strings for individual string arguments while retaining strict checks elsewhere. Use this for notmuch insert --folder, where the empty string means top level folder.
2017-10-09cli: convert notmuch_bool_t to stdboolJani Nikula
C99 stdbool turned 18 this year. There really is no reason to use our own, except in the library interface for backward compatibility. Convert the cli and test binaries to stdbool.
2017-10-04cli: add .present field to opt desc to check if the arg was presentJani Nikula
Add pointer to boolean .present field to opt desc, which (if non-NULL) will be set to TRUE if the argument in question is present on the command line. Unchanged otherwise.
2017-10-04cli: use designated initializers for opt descJani Nikula
Several changes at once, just to not have to change the same lines several times over: - Use designated initializers to initialize opt desc arrays. - Only initialize the needed fields. - Remove arg_id (short options) as unused. - Replace opt_type and output_var with several type safe output variables, where the output variable being non-NULL determines the type. Introduce checks to ensure only one is set. The downside is some waste of const space per argument; this could be saved by retaining opt_type and using a union, but that's still pretty verbose. - Fix some variables due to the type safety. Mostly a good thing, but leads to some enums being changed to ints. This is pedantically correct, but somewhat annoying. We could also cast, but that defeats the purpose a bit. - Terminate the opt desc arrays using {}. The output variable type safety and the ability to add new fields for just some output types or arguments are the big wins. For example, if we wanted to add a variable to set when the argument is present, we could do so for just the arguments that need it. Beauty is in the eye of the beholder, but I think this looks nice when defining the arguments, and reduces some of the verbosity we have there.
2017-07-12cli: change api of parse_optionDavid Bremner
The idea is to allow it (in a future commit) advance to the next argv element to get a value
2014-11-05cli: add support for hierarchical command line option arraysJani Nikula
NOTMUCH_OPT_INHERIT expects a notmuch_opt_desc_t * pointer in output_var. The "Unrecognized option" message was moved out of parse_option() to not be emitted twice or when parsing a non-inherited option.
2014-11-01cli: Add support for parsing keyword-flag argumentsJani Nikula
This allows having multiple --foo=bar --foo=baz options on the command line, with the corresponding values OR'd together. [Test added by Michal Sojka]
2011-12-13command-line-arguments.[ch]: make arrays of keyword descriptors constDavid Bremner
It seems like it should never be necessary to modify these arrays after initialization.
2011-12-08command-line-arguments.[ch]: new argument parsing framework for notmuch.David Bremner
As we noticed when Jani kindly converted things to getopt_long, much of the work in argument parsing in notmuch is due to the the key-value style arguments like --format=(raw|json|text). The framework here provides positional arguments, simple switches, and --key=value style arguments that can take a value being an integer, a string, or one of a set of keywords.