From 86afd4ff110bfa98f8140f8447d5dc22970523af Mon Sep 17 00:00:00 2001 From: Ayo Date: Mon, 23 Jun 2025 21:03:31 +0200 Subject: [PATCH] feat(notes): new subcommand copy -- to copy content using xclip --- ayo.sh | 3 +++ notes.sh | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/ayo.sh b/ayo.sh index f6f3805..8a49a2c 100755 --- a/ayo.sh +++ b/ayo.sh @@ -35,6 +35,9 @@ case $1 in na) # Notes archive . ${HOME}/Projects/scripts/notes.sh archive $2 $3 $4 $5 $6 $7 $8 $9 ;; + nc) # Notes copy + . ${HOME}/Projects/scripts/notes.sh copy $2 $3 $4 $5 $6 $7 $8 $9 + ;; nt) # Notes using typora . ${HOME}/Projects/scripts/notes.sh -t $2 $3 $4 $5 $6 $7 $8 $9 ;; diff --git a/notes.sh b/notes.sh index 9bb744f..7834f94 100755 --- a/notes.sh +++ b/notes.sh @@ -147,6 +147,31 @@ elif [ "$1" = "archive" ] || [ "$1" = "a" ]; then done fi +## COPY content a note from a list +elif [ "$1" = "copy" ] || [ "$1" = "c" ]; then + files=( $notes_dir/*.md ) + + if ! [ "$2" = "" ]; then + index=($2-1) + copy_file=${files[$index]} + echo "Copied content of $copy_file" + xclip -sel c < "$copy_file" + else + PS3="Copy file content #: " + echo "Select a note to COPY Content." + select file in "${files[@]##*/}"; do + { + echo "Copied content of $file" + xclip -sel c < "${notes_dir}/${file}" + break + } || + { + echo "bad choice" + break + } + done + fi + ## CREATE a note (default) else