-
-
Notifications
You must be signed in to change notification settings - Fork 766
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1962 from wassup05/gpgs-gpgv
adds plugins gpgs and gpgv
- Loading branch information
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Description: signs selected files using gpg. | ||
# includes options for clearsigning and | ||
# detached signing documents as well | ||
# | ||
# signed and detach signed files are stored with extension .sig | ||
# whereas clearsigned one are stored as .asc [by default by gpg] | ||
# | ||
# Note: The chosen method of signing is applied to all selected files [if selection is chosen] | ||
# | ||
# Shell: POSIX compliant | ||
# Author: wassup05 | ||
|
||
file=$1 | ||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} | ||
|
||
printf "(s)election/(c)urrent? [default=c] " | ||
read -r file_resp | ||
printf "(s)ign/(c)learsign/(d)etach-sig? [default=s] " | ||
read -r sig_resp | ||
|
||
getfiles(){ | ||
if [ "$file_resp" = "s" ]; then | ||
cat "$selection" | ||
else | ||
printf "%s\0" "$file" | ||
fi | ||
} | ||
|
||
if [ "$sig_resp" = "c" ]; then | ||
getfiles | xargs -0 -I{} gpg --clearsign {} | ||
elif [ "$sig_resp" = "d" ]; then | ||
getfiles | xargs -0 -I{} gpg --detach-sig --output "{}.sig" | ||
else | ||
getfiles | xargs -0 -I{} gpg --sign --output "{}.sig" {} | ||
fi | ||
|
||
# Clear selection | ||
if [ "$file_resp" = "s" ] && [ -p "$NNN_PIPE" ]; then | ||
printf "-" > "$NNN_PIPE" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Description: verifies signed files using gpg. | ||
# includes options for detached signing | ||
# (in which case it asks for a document to verify) | ||
# as well as normal signing | ||
# | ||
# Note: Uses the current file only [selections not supported] | ||
# | ||
# Shell: POSIX compliant | ||
# Author: wassup05 | ||
|
||
file=$1 | ||
|
||
printf "(s)ign/(d)etach-sig [default=s] " | ||
read -r sig_resp | ||
|
||
if [ "$sig_resp" = "d" ]; then | ||
printf "Enter document name: " | ||
read -r doc_name | ||
command gpg --verify "$file" "$doc_name" | ||
else | ||
command gpg --verify "$file" | ||
fi | ||
|
||
printf "\n" | ||
# shellcheck disable=SC2034 | ||
read -r resp # Waiting for input to go back to nnn |