diff options
author | tsxv478 <atci39@rambler.ru> | 2023-05-30 03:20:49 +0300 |
---|---|---|
committer | tsxv478 <atci39@rambler.ru> | 2023-05-30 03:20:49 +0300 |
commit | 449a74c79edfdc9d8ff12e052f2d2ae19c428888 (patch) | |
tree | f6ca41ed809dba43819da04fdf30b6ba0d1bf0f5 | |
parent | 1bd89daea4e7e29ebadf8926f35db39d636402a9 (diff) |
remove note script
-rwxr-xr-x | note | 61 |
1 files changed, 0 insertions, 61 deletions
@@ -1,61 +0,0 @@ -#!/bin/sh - -set -e -notesdir="$HOME/.local/share/notes" - -print_usage() { - cat << EOF -usage: note [option] - -h show this help message - -a append note to the main file - -d append using dmenu - -e edit the main file - -s show last 10 notes - -n create a new file - -l open file in pager -EOF -} - -append_note() { - echo -n "note: " && read -r note - printf "[$(date +'%d/%m/%Y, %H:%M')] %s\n\n" "$note" >> $notesdir/notes.txt -} - -edit_file() { - $EDITOR $notesdir/notes.txt -} - -show_last() { - tail -n 20 $notesdir/notes.txt -} - -new_file() { - echo -n "title: " && read -r title - $EDITOR $notesdir/$title.txt -} - -open_pager() { - find $notesdir -type f -printf "%p\n" | - fzf -e +s --reverse --with-nth -1 -d '/' --preview "cat {}" \ - --preview-window=right:75%:sharp | xargs -ro less -} - -dmenu_note() { - note="$(echo "\c" | dmenu -c -p 'Note:')" - printf "[$(date +'%d/%m/%Y, %H:%M')] %s\n\n" "$note" >> $notesdir/notes.txt -} - -[ $# -eq 0 ] && print_usage - -while getopts "hadesnl" o; do - case "${o}" in - h) print_usage ;; - a) append_note ;; - d) dmenu_note ;; - e) edit_file ;; - s) show_last ;; - n) new_file ;; - l) open_pager ;; - *) print_usage ; exit 1 ;; - esac -done |