AutoYADM commit: 2025-04-23 15:00:05
This commit is contained in:
parent
d31c2a02a6
commit
f8140b5feb
1 changed files with 9 additions and 5 deletions
|
@ -41,7 +41,7 @@ function jrnl --description 'Lightweight journaling tool'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
set -f jdir ~/jrnl
|
set -g jdir ~/jrnl
|
||||||
if set -ql _flag_dir[1]
|
if set -ql _flag_dir[1]
|
||||||
set jdir $_flag_dir[1]
|
set jdir $_flag_dir[1]
|
||||||
else if set -q jrnl_directory
|
else if set -q jrnl_directory
|
||||||
|
@ -59,6 +59,10 @@ function jrnl --description 'Lightweight journaling tool'
|
||||||
set template $jrnl_template
|
set template $jrnl_template
|
||||||
end
|
end
|
||||||
set -f template_base (path basename $template)
|
set -f template_base (path basename $template)
|
||||||
|
function edit -a targ
|
||||||
|
set -l cmd (string split ' ' -- $EDITOR)
|
||||||
|
env -C $jdir $cmd $targ
|
||||||
|
end
|
||||||
|
|
||||||
if not test -f $template
|
if not test -f $template
|
||||||
# first check if template exists in jdir
|
# first check if template exists in jdir
|
||||||
|
@ -81,7 +85,7 @@ function jrnl --description 'Lightweight journaling tool'
|
||||||
echo
|
echo
|
||||||
echo 'Today is %{date_long}.'
|
echo 'Today is %{date_long}.'
|
||||||
end >$template
|
end >$template
|
||||||
eval $EDITOR $template
|
edit $template
|
||||||
set -q _flag_e; and return 0
|
set -q _flag_e; and return 0
|
||||||
break
|
break
|
||||||
case n N
|
case n N
|
||||||
|
@ -91,7 +95,7 @@ function jrnl --description 'Lightweight journaling tool'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if set -q _flag_e
|
if set -q _flag_e
|
||||||
eval $EDITOR $template
|
edit $template
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -112,13 +116,13 @@ function jrnl --description 'Lightweight journaling tool'
|
||||||
printf "\033[1A\033[2K"
|
printf "\033[1A\033[2K"
|
||||||
switch $response
|
switch $response
|
||||||
case y Y
|
case y Y
|
||||||
eval $EDITOR $entry
|
edit $entry
|
||||||
break
|
break
|
||||||
case n N
|
case n N
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
eval $EDITOR $entry
|
edit $entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue