From c90c27f8fc86cbe361a4b3a5ffcaadebc16337b0 Mon Sep 17 00:00:00 2001 From: Score_Under Date: Thu, 4 Feb 2021 12:12:08 +0000 Subject: [PATCH] Add completion for gpgconf --- src/_gpgconf | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/_gpgconf diff --git a/src/_gpgconf b/src/_gpgconf new file mode 100644 index 0000000..6909db9 --- /dev/null +++ b/src/_gpgconf @@ -0,0 +1,44 @@ +#compdef gpgconf +# Description: +# Completions for gpgconf (configuration utility provided with GnuPG +# ) +# +# Authors: +# * "score" https://keybase.io/score_under + +_gpgconf_component() { + local values=( + "${(@f)$(gpgconf --list-components \ + | perl -lne 'my ($name, $desc, $x) = split /:/; print "${name}[$desc]"')}" + ) + if [ "${action[2]}" = all ]; then + values+=('all[All daemon components]') + fi + + _values 'component' "${(o)values[@]}" +} + +_arguments \ + '--help[print help text]' \ + '--list-components[list all components]' \ + '--check-programs[check all programs]' \ + '--apply-defaults[apply global default values]' \ + '--list-dirs[get the configuration directories for gpgconf]' \ + '--list-config[list global configuration file]' \ + '--check-config[check global configuration file]' \ + '--query-swdb[query the software version database]' \ + '--reload[reload all or a given component]:component:_gpgconf_component all' \ + '--launch[launch a given component]:component:_gpgconf_component all' \ + '--kill[kill a given component]:component:_gpgconf_component all' \ + '--create-socketdir[create a directory for sockets below /run/user or /var/run/user]' \ + '--remove-socketdir[remove a directory created with command --create-socketdir]' \ + '--list-options[list options]:component:_gpgconf_component' \ + '--change-options[change options]:component:_gpgconf_component' \ + '--check-options[check options]:component:_gpgconf_component' \ + '--apply-profile[update configuration files using the specified file]:configuration file:_path_files' \ + '--status-fd[write status info to the specified file descriptor]:file descriptor' \ + '(-o --output)'{-o,--output}'[write output to the specified file]:output file:_path_files' \ + '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(-q --quiet)'{-q,--quiet}'[quiet]' \ + '(-n --dry-run)'{-n,--dry-run}'[do not make any changes]' \ + '(-r --runtime)'{-r,--runtime}'[activate changes at runtime, if possible]'