feat(notes): new subcommand copy -- to copy content using xclip
This commit is contained in:
parent
30d9a138fd
commit
86afd4ff11
2 changed files with 28 additions and 0 deletions
3
ayo.sh
3
ayo.sh
|
@ -35,6 +35,9 @@ case $1 in
|
||||||
na) # Notes archive
|
na) # Notes archive
|
||||||
. ${HOME}/Projects/scripts/notes.sh archive $2 $3 $4 $5 $6 $7 $8 $9
|
. ${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
|
nt) # Notes using typora
|
||||||
. ${HOME}/Projects/scripts/notes.sh -t $2 $3 $4 $5 $6 $7 $8 $9
|
. ${HOME}/Projects/scripts/notes.sh -t $2 $3 $4 $5 $6 $7 $8 $9
|
||||||
;;
|
;;
|
||||||
|
|
25
notes.sh
25
notes.sh
|
@ -147,6 +147,31 @@ elif [ "$1" = "archive" ] || [ "$1" = "a" ]; then
|
||||||
done
|
done
|
||||||
fi
|
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)
|
## CREATE a note (default)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue