Skip to content

Add completions for GnuPG 2.x#6062

Closed
LawAbidingCactus wants to merge 5 commits into
fish-shell:masterfrom
LawAbidingCactus:gpg2-completions
Closed

Add completions for GnuPG 2.x#6062
LawAbidingCactus wants to merge 5 commits into
fish-shell:masterfrom
LawAbidingCactus:gpg2-completions

Conversation

@LawAbidingCactus
Copy link
Copy Markdown
Contributor

@LawAbidingCactus LawAbidingCactus commented Aug 24, 2019

Description

Fish's current completions for GnuPG are written for 1.x. They incompletely cover GPG 2.x and include options or subcommands that were removed in the second version. The exact differences between the two tools, with respect to their CLIs, can be viewed with the following set of commands:

gpg1 --dump-options > gpg1options
gpg2 --dump-options > gpg2options
sed -i -e 's/^/gpg1 /' gpg1options
sed -i -e 's/^/gpg2 /' gpg2options
sort -k2 gpg1options gpg2options | uniq -u -f 1 | sort

With recent versions of both tools, this generates the following list of version-specific commands.

This set of completions is mostly copied from fish's existing completions for GPG. It removes GPG 1.x-specific completions and adds GPG 2.x-specific completions.

The following was discussed briefly in #2401, but remained unresolved. On many systems, gpg is symlinked to gpg2-- when this is the case, it would be more appropriate to use these completions than fish's current ones (with gpg2 in the completion script replaced with gpg). gpg.fish could test for the GPG version and activate version-specific completions depending on the result. Something like the following:

if test (gpg --version | sed '1q;d' | cut -b 13 ) -eq 2
    [gpg2-specific completions]
else
    [gpg1-specific completions]
end

This would be fairly trivial for me to do if you guys are okay with it.

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.md

@krobelus
Copy link
Copy Markdown
Contributor

gpg.fish could test for the GPG version and activate version-specific completions depending on
the result.

I think that would be great

Comment thread share/completions/gpg2.fish Outdated
Comment thread share/completions/gpg2.fish
Comment thread share/completions/gpg2.fish Outdated
@zanchey zanchey self-assigned this Sep 21, 2019
@zanchey zanchey added this to the fish 3.1.0 milestone Sep 21, 2019
@zanchey
Copy link
Copy Markdown
Member

zanchey commented Sep 21, 2019

Thanks, I've merged this with rebase (and dropped the CHANGELOG commit, which I'll add back in as part of ongoing CHANGELOG work, because it was causing merge problems) as d2e9ee2..d4a5ef1.

@zanchey zanchey closed this Sep 21, 2019
@LawAbidingCactus LawAbidingCactus mentioned this pull request Sep 24, 2019
3 tasks
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants