Allow user to specify key fingerprint with --fingerprint or -f, or th… #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…rough GPGKEY env variable
An issue was created asking for the ability to specify a GPG key to use from the keychain, as it grabs the first. There was an -e option added at some point allowing one to choose the proper GPG key from the keychain by email address; however, if a user has multiple keys that match the same Email address, this will still grab the first key found.
Added an option --fingerprint (or -f) to search for the first key matching the given key fingerprint. The user supplied fingerprint is regex-matched at the END of the fingerprint string stored in the key object, as many users use shortened fingerprint strings.
In addition, if the GPGKEY environment variable (used by other GPG tools) is set to a fingerprint, that is used as the default value of the --fingerprint (-f) option.
I am not an expert ruby coder, but this seemed to work reasonably well without disabling the -e option, and appears to integrate well with other GPG tools that assume use of GPGKEY env variable. I am entirely open to requests for revision, or to other people making better changes.
This is a partial answer to issue #17. It does not follow the setting in the gpg config file, but does follow the env variable used to do the same thing. Ideally both would be supported, but this allows for flexibility to bypass such defaults when desired.