refactor: share editFile function
This commit is contained in:
parent
81889f62e0
commit
41b0f389f3
3 changed files with 14 additions and 15 deletions
13
functions.sh
13
functions.sh
|
|
@ -36,6 +36,19 @@ notesSync() {
|
|||
fi
|
||||
}
|
||||
|
||||
function editFile() {
|
||||
notesSync
|
||||
|
||||
# Open in editor
|
||||
if [ "$typora" = "t" ]; then
|
||||
typora "$1"
|
||||
else
|
||||
vim + "$1"
|
||||
fi
|
||||
|
||||
clear
|
||||
notesSync
|
||||
}
|
||||
|
||||
yes_or_no() {
|
||||
while true; do
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ function createEntry() {
|
|||
if [ "$typora_flag" = true ]; then
|
||||
typora "$full_path" > /dev/null 2>/dev/null
|
||||
else
|
||||
vim "$full_path"
|
||||
editFile "$full_path"
|
||||
fi
|
||||
} || {
|
||||
# Report; TODO: write log
|
||||
|
|
|
|||
14
notes.sh
14
notes.sh
|
|
@ -6,20 +6,6 @@
|
|||
|
||||
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() {
|
||||
{
|
||||
if [ "$1" = "" ]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue