mirror of https://github.com/nirenjan/dotfiles.git
Fix check_empty and add show command to note
check_empty for restore was trying to run a git checkout in the current working directory, instead of in the ~/.notes directory. Fix this issue note_show uses less to display the contents of the note file.master
parent
8d0349f999
commit
2fda4cbad2
20
note
20
note
|
@ -68,11 +68,14 @@ check_empty() {
|
|||
then
|
||||
if [[ "$1" == "restore" ]]
|
||||
then
|
||||
cd "$NOTES_DIR"
|
||||
gitfile=$(basename "$note_file")
|
||||
git checkout $gitfile
|
||||
echo "Restored empty note $note_arg"
|
||||
elif [[ "$1" == "delete" ]]
|
||||
then
|
||||
rm -f $note_file
|
||||
echo "Deleted empty note $note_arg"
|
||||
fi
|
||||
|
||||
exit
|
||||
|
@ -198,6 +201,19 @@ note_edit() {
|
|||
echo "Updated note '$note_new_title'"
|
||||
}
|
||||
|
||||
note_show() {
|
||||
check_dir
|
||||
check_arg
|
||||
title_to_name
|
||||
if ! note_exists
|
||||
then
|
||||
echo "Cannot find note '$note_arg'!"
|
||||
exit
|
||||
fi
|
||||
|
||||
less -R $note_file
|
||||
}
|
||||
|
||||
note_delete() {
|
||||
check_dir
|
||||
check_arg
|
||||
|
@ -266,6 +282,10 @@ parse_args() {
|
|||
note_edit
|
||||
;;
|
||||
|
||||
"show")
|
||||
note_show
|
||||
;;
|
||||
|
||||
"del" | "delete")
|
||||
note_delete
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue