feat(notes): better prompts
This commit is contained in:
parent
2a74eb4c33
commit
be3339941b
1 changed files with 8 additions and 5 deletions
13
notes.sh
13
notes.sh
|
@ -27,7 +27,7 @@ function editFile() {
|
||||||
|
|
||||||
function createNote() {
|
function createNote() {
|
||||||
{
|
{
|
||||||
read -p "Enter file name: " title
|
read -p "Create new note: " title
|
||||||
file_name=$title.md
|
file_name=$title.md
|
||||||
full_path="${notes_dir}/${file_name}"
|
full_path="${notes_dir}/${file_name}"
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ function createNote() {
|
||||||
if [ "$1" = "list" ] || [ "$1" = "l" ]; then
|
if [ "$1" = "list" ] || [ "$1" = "l" ]; then
|
||||||
files=( $notes_dir/*.md )
|
files=( $notes_dir/*.md )
|
||||||
index=0
|
index=0
|
||||||
|
notesSync
|
||||||
for file in "${files[@]##*/}"; do
|
for file in "${files[@]##*/}"; do
|
||||||
((index++))
|
((index++))
|
||||||
echo "$index) $file"
|
echo "$index) $file"
|
||||||
|
@ -58,8 +59,9 @@ if [ "$1" = "list" ] || [ "$1" = "l" ]; then
|
||||||
elif [ "$1" = "open" ] || [ "$1" = "o" ]; then
|
elif [ "$1" = "open" ] || [ "$1" = "o" ]; then
|
||||||
files=( $notes_dir/*.md )
|
files=( $notes_dir/*.md )
|
||||||
PS3="Open file #: "
|
PS3="Open file #: "
|
||||||
echo "Please select a file."
|
echo "Please select a file to OPEN."
|
||||||
COLUMNS=0; select file in "${files[@]##*/}"; do
|
notesSync
|
||||||
|
select file in "${files[@]##*/}"; do
|
||||||
{
|
{
|
||||||
echo "Opening $file"
|
echo "Opening $file"
|
||||||
editFile "$file"
|
editFile "$file"
|
||||||
|
@ -73,8 +75,9 @@ elif [ "$1" = "open" ] || [ "$1" = "o" ]; then
|
||||||
elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then
|
elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then
|
||||||
files=( $notes_dir/*.md )
|
files=( $notes_dir/*.md )
|
||||||
PS3="Remove file #: "
|
PS3="Remove file #: "
|
||||||
echo "Please select a file."
|
echo "Please select a file to REMOVE."
|
||||||
COLUMNS=0; select file in "${files[@]##*/}"; do
|
notesSync
|
||||||
|
select file in "${files[@]##*/}"; do
|
||||||
{
|
{
|
||||||
echo "Removing $file"
|
echo "Removing $file"
|
||||||
rm "${notes_dir}/${file}"
|
rm "${notes_dir}/${file}"
|
||||||
|
|
Loading…
Reference in a new issue