Skip to content

Commit f36ee42

Browse files
authored
Merge pull request #17 from dineshsaini/main
minor fixes
2 parents 0d1f9ff + f3d45d9 commit f36ee42

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

annote.sh

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
###############################################################################
66

77
__NAME__='annote'
8-
__VERSION__='2.5'
8+
__VERSION__='2.5.3'
99

1010
# variables
1111
c_red="$(tput setaf 196)"
@@ -572,7 +572,7 @@ function _create_note {
572572
touch "$nloc/$nid.group"
573573
touch "$nloc/$nid.tags"
574574
touch "$nloc/$nid.metadata"
575-
printf '%s\n' "Created On: $(date --date="@${nid#n}")" > "$nloc/$nid.metadata"
575+
printf '%s\n' "Created On: $(date --date="@${nid#n}" '+%A %d %B %Y %r %Z')" > "$nloc/$nid.metadata"
576576
printf '%s' "$nid"
577577
}
578578

@@ -595,7 +595,7 @@ function _new_note {
595595
printf '%s\n' "$nid" >> "$tl/notes.lnk"
596596
fi
597597
done < <(printf '%s' "$tags,")
598-
printf '%s\n' "Modified On: $(date)" >> "$nloc/$nid.metadata"
598+
printf '%s\n' "Modified On: $(date '+%A %d %B %Y %r %Z')" >> "$nloc/$nid.metadata"
599599
printf '%s' "$nid"
600600
}
601601

@@ -676,7 +676,7 @@ function get_metadata {
676676
local value=""
677677
if $(note_exists "$nid"); then
678678
local mfile="$notes_loc/$nid/$nid.metadata"
679-
value="$(sed -n -e "s/^$key: //p" $mfile)"
679+
value="$(sed -n -e "s/^$key: //p" "$mfile")"
680680
fi
681681
printf '%s' "$value"
682682
}
@@ -737,15 +737,15 @@ function add_note {
737737
fi
738738
;;
739739
esac
740-
update_metadata "$nid" "Modified On" "$(date)"
740+
update_metadata "$nid" "Modified On" "$(date '+%A %d %B %Y %r %Z')"
741741
}
742742

743743
function _list_prettify_fg {
744744
local c="$1"
745745
local txt="$2"
746746
local bold="$3"
747747
if [ "x$flag_no_pretty" != "xy" ]; then
748-
if [ $(( $c % 2 )) -eq 0 ]; then
748+
if [ $(( c % 2 )) -eq 0 ]; then
749749
txt="$(as_cyan "$txt")"
750750
else
751751
txt="$(as_light_green_2 "$txt")"
@@ -761,7 +761,7 @@ function _list_prettify_bg {
761761
local c="$1"
762762
local txt="$2"
763763
if [ "x$flag_no_pretty" != "xy" ]; then
764-
if [ $(( $c % 2 )) -eq 0 ]; then
764+
if [ $(( c % 2 )) -eq 0 ]; then
765765
txt="$(on_light_black "$txt")"
766766
else
767767
txt="$(on_dark_black "$txt")"
@@ -1019,8 +1019,8 @@ function list_groups {
10191019

10201020
if [ -z "$groups" ]; then
10211021
while IFS= read -r line; do
1022-
line="${line#$gl/}"
1023-
$groups="$groups,${line////.}"
1022+
line="${line#"$gl"/}"
1023+
groups="$groups,${line////.}"
10241024
done < <(find "$gl" -type f -name 'notes.lnk' -printf '%h\n')
10251025
groups="${groups#,}"
10261026
else
@@ -1069,7 +1069,7 @@ function list_tags {
10691069

10701070
if [ -z "$tags" ]; then
10711071
while IFS= read -r line; do
1072-
$tags="$tags,${line#$tags_loc/}"
1072+
tags="$tags,${line#"$tags_loc"/}"
10731073
done < <(find "$tags_loc" -mindepth 1 -maxdepth 2 -type f \
10741074
-name 'notes.lnk' -printf '%h\n')
10751075
tags="${tags#,}"
@@ -1204,7 +1204,7 @@ function modify_note {
12041204
fi
12051205
;;
12061206
esac
1207-
update_metadata "$nid" "Modified On" "$(date)"
1207+
update_metadata "$nid" "Modified On" "$(date '+%A %d %B %Y %r %Z')"
12081208
fi
12091209
}
12101210

@@ -1403,7 +1403,7 @@ function get_subgroups {
14031403
gl="${gl%/}"
14041404

14051405
while IFS= read -r line; do
1406-
line="${line#$groups_loc/}"
1406+
line="${line#"$groups_loc"/}"
14071407
sgrps="$sgrps,${line////.}"
14081408
done < <(find "$gl" -mindepth 2 -type f -name 'notes.lnk' -printf '%h\n')
14091409
sgrps="${sgrps#,}"
@@ -1467,7 +1467,7 @@ function find_groups {
14671467

14681468
if [ -n "$gpat" ]; then
14691469
while IFS= read -r line; do
1470-
line="${line#$groups_loc/}"
1470+
line="${line#"$groups_loc"/}"
14711471
line="${line%/}"
14721472
groups="$groups,${line////.}"
14731473
done < <(find "$groups_loc" -mindepth 1 -type d \
@@ -1560,7 +1560,6 @@ function find_notes {
15601560
shopt -q nocasematch || shopt -s nocasematch
15611561
for n in ${notes//,/ }; do
15621562
local nt="$(get_note_tags "$n")"
1563-
local f=""
15641563
for t in ${find_with_tags//,/ }; do
15651564
if [[ ,$nt, =~ ,.*$t.*, ]]; then
15661565
tnotes="$tnotes,$n"

0 commit comments

Comments
 (0)