minor improvements
This commit is contained in:
18
src/main.sh
18
src/main.sh
@@ -145,14 +145,7 @@ if [ "${1:-}" = "--delete" ]; then
|
||||
fi
|
||||
# Generate new entry
|
||||
if [ "${1:-}" = "--new" ]; then
|
||||
label=$(printf "%s" "$COLLECTION_LABELS" |
|
||||
awk 'BEGIN { FS="="; RS=";"; } {print $2}' |
|
||||
$FZF \
|
||||
--margin 20% \
|
||||
--prompt="Select collection> ")
|
||||
|
||||
collection=$(printf "%s" "$COLLECTION_LABELS" |
|
||||
awk -v label="$label" 'BEGIN { FS="="; RS=";"; } $2 == label {print $1}')
|
||||
collection=$(echo "$COLLECTION_LABELS" | tr ';' '\n' | fzf --delimiter='=' --with-nth=2 --accept-nth=1)
|
||||
file=""
|
||||
while [ -f "$file" ] || [ -z "$file" ]; do
|
||||
uuid=$(uuidgen)
|
||||
@@ -230,10 +223,8 @@ fi
|
||||
if [ "${1:-}" = "--no-journal" ]; then
|
||||
query="!📘"
|
||||
fi
|
||||
if [ -z "$query" ]; then
|
||||
query="!✅"
|
||||
fi
|
||||
query=$(echo "$query" | sed 's/ *$//g')
|
||||
query=${query:-!✅}
|
||||
query=$(echo "$query" | xargs)
|
||||
|
||||
selection=$(
|
||||
__lines | $FZF --ansi \
|
||||
@@ -252,7 +243,7 @@ selection=$(
|
||||
--bind="alt-1:change-query(📘)" \
|
||||
--bind="alt-2:change-query(🗒️)" \
|
||||
--bind="alt-3:change-query(✅ | 🔲)" \
|
||||
--bind="ctrl-s:execute($SYNC_CMD ; echo 'Press <enter> to continue.'; read -r tmp)"
|
||||
--bind="ctrl-s:execute($SYNC_CMD ; printf 'Press <enter> to continue.'; read -r tmp)"
|
||||
)
|
||||
if [ -z "$selection" ]; then
|
||||
return 0
|
||||
@@ -275,7 +266,6 @@ $EDITOR "$filetmp" >/dev/tty
|
||||
|
||||
# Update only if changes are detected
|
||||
if [ "$checksum" != "$(cksum "$filetmp")" ]; then
|
||||
echo "Uh... chages detected!" >/dev/tty
|
||||
file_new="$filetmp.ics"
|
||||
awk "$AWK_UPDATE" "$filetmp" "$file" >"$file_new"
|
||||
mv "$file_new" "$file"
|
||||
|
||||
Reference in New Issue
Block a user