danix
's git repository
home
/
my projects
/
bash-notes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d80ac20
)
we can now edit a note and list all notes
author
danix
<danix@danix.xyz>
Fri, 24 Mar 2023 15:26:31 +0000
(16:26 +0100)
committer
danix
<danix@danix.xyz>
Fri, 24 Mar 2023 15:26:31 +0000
(16:26 +0100)
notes.sh
patch
|
blob
|
blame
|
history
diff --git
a/notes.sh
b/notes.sh
index
3fc89e3
..
edec94d
100644
(file)
--- a/
notes.sh
+++ b/
notes.sh
@@
-97,11
+97,27
@@
function addnote() {
}
function listnotes() {
}
function listnotes() {
- echo "list all notes"
+ echo "listing all notes"
+ echo ""
+ echo "[ID] [TITLE]"
+ for i in ${NOTESDIR}/*; do
+ TITLE=$($JQ -r --arg z $(basename $i) '.notes[] | select(.file == $z) | .title' $DB)
+ ID=$($JQ -r --arg z $(basename $i) '.notes[] | select(.file == $z) | .id' $DB)
+
+ echo "[${ID}] ${TITLE}"
+ done
}
function editnote() {
}
function editnote() {
- echo "edit note \"${1}\""
+ TITLE=$($JQ --arg i $1 '.notes[] | select(.id == $i) | .title' $DB)
+ FILE=$($JQ -r --arg i $1 '.notes[] | select(.id == $i) | .file' $DB)
+ if [ "$TITLE" ]; then
+ echo "editing note $TITLE"
+ $(${TERMINAL} --class notes --title notes -e ${EDITOR} ${NOTESDIR}/${FILE})
+ else
+ echo "note not found"
+ exit 1
+ fi
}
function datenote() {
}
function datenote() {