Home GnuPG

core: Implement meta commands for the argparser.

Description

core: Implement meta commands for the argparser.

* src/argparse.c (opttable_t): Add new flags forced, ignore, and
explicit_ignore.
(struct _gpgrt_argparse_internal_s): Change flags to bitflags.  Add
several flags to support meta commands.
(initialize): Clear them.
(handle_meta_user): Use the new verbose flag.
(handle_meta_force): Implement.
(handle_meta_ignore): Implement.
(handle_meta_echo): Support "-echo".
(handle_meta_verbose): New.
(handle_metacmd): New meta command verbose.  Add always flag and move
the detection of unexpected meta commands to here.
(_gpgrt_argparse): Make use of the ignore and forced meta commands.
(finish_read_sys): New.
(_gpgrt_argparser): Support the verbose flag.  Call finish_read_sys.
(arg_parse): Ignore non-explicit ignored and all forced options.
* tests/t-argparse.c (main): Fix printing of the ARGPARSE_CONFFILE
case.  New option 'M'.
* tests/t-argparse.conf, tests/etc/t-argparse.conf: Various changes to
test the new meta commands.

For the command line we print a diagnostic if an ignored or forced
options is used. However, we do not ignore options which are only set
via [ignore-all]. The rationale for the latter is that an
administrator can't be be required to unignore all options used by all
modes, of say gpgme.

Documentation of the meta commands will for now be added to GnuPG.

  • GnuPG-bug-id: T4788
  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Feb 27 2020, 12:32 PM
Parents
rEffa21bf5b706: indent: Fix indentation in an argparse.c function
Branches
Unknown
Tags
Unknown
Tasks
T4788: System wide configuration of the GnuPG system