Gpg : Fix bash functions default args to match documentation.
This commit is contained in:
parent
cc39e237e6
commit
f727a5f97c
|
@ -5,10 +5,14 @@
|
||||||
function encrypt() {
|
function encrypt() {
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local targets=(''${@})
|
local targets=(''${@})
|
||||||
[[ "''${targets}" = "" ]] && targets=($(_ls_file))
|
|
||||||
|
if [[ "''${targets}" = "" ]]; then
|
||||||
|
help encrypt
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
process() {
|
process() {
|
||||||
gpg --encrypt --armor --recipient hi@voronind.com --output "''${target}.enc" "''${target}"
|
gpg --encrypt --armor --recipient hi@voronind.com --output "''${target}.gpg" "''${target}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_iterate_targets process ''${targets[@]}
|
_iterate_targets process ''${targets[@]}
|
||||||
|
@ -19,10 +23,14 @@
|
||||||
function decrypt() {
|
function decrypt() {
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local targets=(''${@})
|
local targets=(''${@})
|
||||||
[[ "''${targets}" = "" ]] && targets=($(_ls_file))
|
|
||||||
|
if [[ "''${targets}" = "" ]]; then
|
||||||
|
help decrypt
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
process() {
|
process() {
|
||||||
gpg --decrypt --output "''${target%.enc}" "''${target}"
|
gpg --decrypt --output "''${target%.gpg}" "''${target}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_iterate_targets process ''${targets[@]}
|
_iterate_targets process ''${targets[@]}
|
||||||
|
@ -33,7 +41,11 @@
|
||||||
function sign() {
|
function sign() {
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local targets=(''${@})
|
local targets=(''${@})
|
||||||
[[ "''${targets}" = "" ]] && targets=($(_ls_file))
|
|
||||||
|
if [[ "''${targets}" = "" ]]; then
|
||||||
|
help sign
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
process() {
|
process() {
|
||||||
gpg --detach-sig --armor --output "''${target}.sig" "''${target}"
|
gpg --detach-sig --armor --output "''${target}.sig" "''${target}"
|
||||||
|
@ -42,11 +54,12 @@
|
||||||
_iterate_targets process ''${targets[@]}
|
_iterate_targets process ''${targets[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify a signature.
|
# Verify a signature. All .sig files by default.
|
||||||
# Usage: verify <FILES>
|
# Usage: verify [FILES]
|
||||||
function verify() {
|
function verify() {
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local targets=(''${@})
|
local targets=(''${@})
|
||||||
|
|
||||||
[[ "''${targets}" = "" ]] && targets=(*.sig)
|
[[ "''${targets}" = "" ]] && targets=(*.sig)
|
||||||
|
|
||||||
process() {
|
process() {
|
||||||
|
|
Loading…
Reference in a new issue