Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This script was heavily inspired by [todo.txt-cli](https://github.com/todotxt/to
- Simple: 1 Bash script, 1 environment variable and 1 symlink.
- Markdown.
- Search notes.
- Quick add notes
- Sync notes across multiple computers.

## Setup
Expand Down
8 changes: 7 additions & 1 deletion src/note.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,24 @@ function usage() {
echo "Usage: note.sh [action]"
echo
echo " actions:"
echo " add [new note in quotes to add at end of today-file]"
echo " grep [pattern]"
}

mkdir -p "$NOTE_DIR"
TODAYFILE="$NOTE_DIR/$(date +'%Y-%m-%d').md"


if [ $# -eq 0 ]; then
$EDITOR "$NOTE_DIR/$(date +'%Y-%m-%d').md"
$EDITOR "$TODAYFILE"
else
case $1 in
grep)
grep -i -r --color "$2" "$NOTE_DIR"
;;
add)
echo "$2" >> "$TODAYFILE"
;;
*)
usage
;;
Expand Down