refactor: share editFile function

This commit is contained in:
ayo 2026-06-26 10:52:11 +02:00
parent 81889f62e0
commit 41b0f389f3
3 changed files with 14 additions and 15 deletions

View file

@ -36,6 +36,19 @@ notesSync() {
fi fi
} }
function editFile() {
notesSync
# Open in editor
if [ "$typora" = "t" ]; then
typora "$1"
else
vim + "$1"
fi
clear
notesSync
}
yes_or_no() { yes_or_no() {
while true; do while true; do

View file

@ -42,7 +42,7 @@ function createEntry() {
if [ "$typora_flag" = true ]; then if [ "$typora_flag" = true ]; then
typora "$full_path" > /dev/null 2>/dev/null typora "$full_path" > /dev/null 2>/dev/null
else else
vim "$full_path" editFile "$full_path"
fi fi
} || { } || {
# Report; TODO: write log # Report; TODO: write log

View file

@ -6,20 +6,6 @@
getopts "t" typora; #check if -t flag is given getopts "t" typora; #check if -t flag is given
function editFile() {
notesSync
# Open in editor
if [ "$typora" = "t" ]; then
typora "$1"
else
vim "$1"
fi
clear
notesSync
}
function createNote() { function createNote() {
{ {
if [ "$1" = "" ]; then if [ "$1" = "" ]; then