feat(notes): new subcommand copy -- to copy content using xclip

This commit is contained in:
Ayo Ayco 2025-06-23 21:03:31 +02:00
parent 30d9a138fd
commit 86afd4ff11
2 changed files with 28 additions and 0 deletions

3
ayo.sh
View file

@ -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
;;

View file

@ -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