Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add completions for GnuPG 2.x #6062

Closed
wants to merge 5 commits into from
Closed

Add completions for GnuPG 2.x #6062

wants to merge 5 commits into from

Conversation

LawAbidingCactus
Copy link
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
Member

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

I think that would be great

share/completions/gpg2.fish Outdated Show resolved Hide resolved
share/completions/gpg2.fish Outdated Show resolved Hide resolved
@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
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.

None yet

3 participants