Merge branch 'SNSv2' of alfheim.central.xn:xilmwa/sns into SNSv2
This commit is contained in:
@@ -47,6 +47,7 @@ _sns_complete_entries () {
|
||||
[[ -d $item ]] && item="$item/"
|
||||
|
||||
item="${item%$suffix}"
|
||||
item="${item%.gpg}"
|
||||
COMPREPLY+=("${item#$prefix}")
|
||||
done
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ fi
|
||||
# If encryption is enabled, decrypt $NOTE to a temp file, otherwise
|
||||
# operate on the note directly.
|
||||
if [ "$ENCRYPTION" == "TRUE" ]; then
|
||||
cp "$NOTES_DIR/$NOTE" "$NOTES_DIR$/$NOTE".bk #Insurance
|
||||
cp "$NOTES_DIR/$NOTE" "$NOTES_DIR/$NOTE.bk" #Insurance
|
||||
TMP_NOTE="$TMP_DIR/$SESSION_ID"
|
||||
decrypt > "$TMP_NOTE"
|
||||
else
|
||||
@@ -26,7 +26,7 @@ fi
|
||||
|
||||
# Write an ammendment header
|
||||
if [ -z "$CREATE" ]; then
|
||||
printf "\n%s\n" "edit - $(date $DATE_FMT)" >> "$TMP_NOTE"
|
||||
printf "\n%s\n" "edit - $(date "$DATE_FMT")" >> "$TMP_NOTE"
|
||||
printf "%s\n" "===================================" >> "$TMP_NOTE"
|
||||
fi
|
||||
|
||||
@@ -36,9 +36,11 @@ printf " - %s\n" "editing ${NOTE%.*}"
|
||||
|
||||
# If the file was previously decrypted, encrypt it back
|
||||
if [ "$ENCRYPTION" == "TRUE" ]; then
|
||||
echo "reencrypting"
|
||||
rm "$NOTES_DIR/$NOTE"
|
||||
encrypt;
|
||||
if [ ! -r "$NOTE" ]; then
|
||||
rm "$TMP_NOTE"
|
||||
if [ ! -r "$NOTES_DIR/$NOTE" ]; then
|
||||
>&2 printf " $RED_COLOR!$RESET_COLOR %s\n" "error: note was not saved."
|
||||
cp "$NOTES_DIR/$NOTE.bk" "$NOTES_DIR/$NOTE"
|
||||
else
|
||||
|
||||
@@ -16,7 +16,7 @@ EXT=note # File extension to use (for listing notes)
|
||||
|
||||
DATE_FMT="+%D %T" # Date Format:
|
||||
# If you would like to modify the date format, you may
|
||||
# specify one appropriate to the `date` command.
|
||||
# specify one appropriate to the \`date\` command.
|
||||
|
||||
ENCRYPTION="FALSE" # Main Encryption Toggle:
|
||||
# WARNING: ANY PREVIOUSLY UNENCRYPTED NOTES WILL BE LOST
|
||||
|
||||
@@ -3,7 +3,7 @@ function encrypt(){
|
||||
# output file, $NOTE, will encrypt $TMP_NOTE to $NOTE against $PUBKEY's private
|
||||
# GPG key.
|
||||
|
||||
gpg -r "$PUBKEY" -o "$NOTE" -e "$TMP_NOTE"
|
||||
gpg -r "$PUBKEY" -o "$NOTES_DIR/$NOTE" -e "$TMP_NOTE"
|
||||
|
||||
}
|
||||
|
||||
@@ -11,5 +11,5 @@ function decrypt(){
|
||||
# This function, given a file to decrypt, will attempt to decrypt the file
|
||||
# against the specified recipient's private key, and print the result to
|
||||
# stdout.
|
||||
gpg -d "$NOTE"
|
||||
gpg -d "$NOTES_DIR/$NOTE"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
function p_header(){
|
||||
printf "# %s\n## Date: %s\n" "$(basename ${NOTE%.*})" "$(date "$DATE_FMT")"
|
||||
printf "# %s\n## %s\n" "$(basename ${NOTE%.*})" "$(date "$DATE_FMT")"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user