mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
gpg: New option --list-filter
* g10/gpg.c (oListFilter): New. (opts): Add --list-filter. (main): Parse oListFilter. * g10/keylist.c: Include init.h and recsel.h. (struct list_filter_s, list_filter): New. (release_list_filter): New. (cleanup_keylist_globals): New. (parse_and_set_list_filter): New. (list_keyblock): Implement --list-filter type "select". * g10/import.c (impex_filter_getval): Add scope support and new property names "key-size", "algostr", "origin", "lastupd", and "url". -- This option is pretty useful to select keys based on their properties. The scope thing can be sued to limit a selection to just the primary key or to subkeys. For example: gpg -k --list-filter 'select=revoked-f && sub/algostr=ed25519' Lists all non-revoked keys with an ed25519 (signing)-subkey.
This commit is contained in:
parent
d70779bdc6
commit
1324dc3490
7 changed files with 204 additions and 14 deletions
|
@ -327,6 +327,7 @@ enum cmd_and_opt_values
|
|||
oExportOptions,
|
||||
oExportFilter,
|
||||
oListOptions,
|
||||
oListFilter,
|
||||
oVerifyOptions,
|
||||
oTempDir,
|
||||
oExecPath,
|
||||
|
@ -794,6 +795,7 @@ static gpgrt_opt_t opts[] = {
|
|||
ARGPARSE_header ("Keylist", N_("Options controlling key listings")),
|
||||
|
||||
ARGPARSE_s_s (oListOptions, "list-options", "@"),
|
||||
ARGPARSE_s_s (oListFilter, "list-filter", "@"),
|
||||
ARGPARSE_s_n (oFullTimestrings, "full-timestrings", "@"),
|
||||
ARGPARSE_s_n (oShowPhotos, "show-photos", "@"),
|
||||
ARGPARSE_s_n (oNoShowPhotos, "no-show-photos", "@"),
|
||||
|
@ -3357,6 +3359,11 @@ main (int argc, char **argv)
|
|||
if (rc)
|
||||
log_error (_("invalid filter option: %s\n"), gpg_strerror (rc));
|
||||
break;
|
||||
case oListFilter:
|
||||
rc = parse_and_set_list_filter (pargs.r.ret_str);
|
||||
if (rc)
|
||||
log_error (_("invalid filter option: %s\n"), gpg_strerror (rc));
|
||||
break;
|
||||
case oListOptions:
|
||||
if(!parse_list_options(pargs.r.ret_str))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue