File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,12 @@ function _print_gpg_decrypt_error_msg() {
45
45
}
46
46
47
47
function _usage() {
48
- echo " $bold_color ${fg[red]} Usage: $0 [-r <string> -r <string>...]$reset_color " 1>&2
48
+ echo " Usage: [ [-r <string> ...] [-y] ]" 1>&2
49
+ echo
50
+ echo " Optional args:"
51
+ echo
52
+ echo " -r receipients"
53
+ echo " -y force"
49
54
return
50
55
}
51
56
@@ -80,10 +85,10 @@ function history_sync_pull() {
80
85
81
86
# Encrypt and push current history to master
82
87
function history_sync_push() {
83
- # Get option recipients
88
+ # Get options recipients, force
84
89
local recipients=()
85
90
local force=false
86
- while getopts yr: opt; do
91
+ while getopts r:y opt; do
87
92
case " $opt " in
88
93
r)
89
94
recipients+=" $OPTARG "
@@ -104,10 +109,12 @@ function history_sync_push() {
104
109
read name
105
110
recipients+=" $name "
106
111
fi
112
+
107
113
ENCRYPT_CMD=" $GPG --yes -v "
108
114
for r in " ${recipients[@]} " ; do
109
115
ENCRYPT_CMD+=" -r \" $r \" "
110
116
done
117
+
111
118
if [[ " $ENCRYPT_CMD " =~ ' .(-r).+.' ]]; then
112
119
ENCRYPT_CMD+=" --encrypt --sign --armor --output $ZSH_HISTORY_FILE_ENC $ZSH_HISTORY_FILE "
113
120
eval " $ENCRYPT_CMD "
@@ -150,6 +157,7 @@ function history_sync_push() {
150
157
;;
151
158
esac
152
159
fi
160
+
153
161
if [[ " $? " != 0 ]]; then
154
162
_print_git_error_msg
155
163
cd " $DIR "
You can’t perform that action at this time.
0 commit comments