diff --git a/.shellnotes_version b/.shellnotes_version index 5625e59..cd5ac03 100644 --- a/.shellnotes_version +++ b/.shellnotes_version @@ -1 +1 @@ -1.2 +2.0 diff --git a/README.md b/README.md index 24183b2..21b22e8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ A simple and easy way to keep notes via your linux terminal. # Basic Commands: ## newnote: - Write a new note using your text editor. + Write a new note using gedit. ## quicknote: Write a note directly from terminal. ## readnote: @@ -15,7 +15,14 @@ A simple and easy way to keep notes via your linux terminal. ## delnote: Delete a note from your notes folder. ## shellnotes(-v,-r,-h or --help): - Information about shellnotes, updates, help, and more. + Information about shellnotes. +## findnote: + Find a specific note in your Notes folder. +##findmisplacednote: + Find a misplaced note in your system. +## renamenote: + Rename a note. + # How to download @@ -38,12 +45,14 @@ A simple and easy way to keep notes via your linux terminal. ## step 4: -Open any text editor you want. Select "Open file" from its menu (Usually top left) and navigate to your home folder. Then, press `Ctrl + H` in order to show all the hidden files and folders -in the home directory. Find a file called `.bashrc` and open it. (Different file for different shell) +in the home directory. Find a file called `.bashrc` and open it. ## step 5: --Go to the last line of the file you opened in step 4, and write: `source ~/.shellnotes.sh` in order to be able to use shellnotes every time you launch your terminal. +-Go to the last line of the file you opened at step 4, and write: `source ~/.shellnotes.sh` in order to be able to use shellnotes every time you launch your terminal. # Warnings! +*THIS SYSTEM IS MADE FOR BASH SHELL* (Change your shell if necessary.) + *DON'T CHANGE THE SCRIPT* (Only in case you don't have the default editors who are gedit and nano. In that case, you can either change them, or install the default ones.) diff --git a/SECURITY.md b/SECURITY.md index fbd2012..1b83e43 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,4 +1,4 @@ -# Version support +# Security Policy ## Supported Versions of shellnotes @@ -6,7 +6,8 @@ | Version | Supported | | ------- | ------------------ | -| 1.2.x | yes | +| 2.0.x | yes | +| 1.2.x | yes | | 1.1.x | yes | | 1.0.x | yes | | 0.1.x | no | @@ -14,5 +15,5 @@ ## About updating -Every new update is uploaded in the release page. +Every new update is uploaded in this page. If you want to check your version, type "shellnotes -v" and check if the version is supported. diff --git a/help b/help new file mode 100644 index 0000000..aa36dc2 --- /dev/null +++ b/help @@ -0,0 +1,47 @@ + SHELLNOTES HELP PAGE + -------------------- + +Commands: + -newnote: Write a new note using gedit. + -quicknote: Write a note directly from terminal. + -readnote: Read a note from your text-editor. + -quickread: Read a note directly from terminal. + -listnotes: View a full list of notes from your notes folder. + -delnote: Delete a note from your notes folder. + -shellnotes: Information about shellnotes. + -findnote: Find a specific note in your Notes folder. + -findmisplacednote: Find a misplaced note in your system. + -renamenote: Rename a note in your Notes folder. + +Usage: + -newnote: Take your notes in the text editor and name the file. + -quicknote: Write the name of the file and take your notes in the terminal, press Ctrl+X, then Y to save. Rename the file if you'd like, then hit Enter key to save. + -readnote: Type the name of the file and start reading your notes from your text-editor. + -quickread: Type the name of the file and start reading your notes from your terminal. + -delnote: Write the name of the note you want to delete, or add '-all' to delete all notes. + -findnote: Type the name of the note you want to locate. + -findmisplacednote: Type the name of the misplaced note and check the possible locations + -renamenote: Enter the name of the note, then the new note name and press enter. + +shellnotes Parameters: + -v: version + -r: github repository + -h or --help: help + +Tips: + -If a note that you want to read using readnote doesn't exist, you will be asked to create one using newnote. + -If a note that you want to write with quicknote already exists, you will be asked to read it using readnote. + -If you type a blank note name in readnote, you will automatically create a new note. You can do this if you want to take a note but you are using readnote. + -Deleting notes using delnote won't send the files to Trash. They will be deleted forever, so don't store other files in your Notes folder. + -Even if you don't have a Notes folder, shellnotes will make one for you. + -No matter in which directory you are, shellnotes will work from everywhere - and when your done taking notes, you will get back on your previous working directory! + -If you want to check if shellnotes is working proprely, try typing "shellnotes" in the terminal! + -If you want to delete all your notes inside your folder, type "delnote -all". + +Don't seem to find your note? Try these steps: + 1. Type findnote in your terminal and try to locate the file in your Notes folder. + 2. Try using findmisplacednote to check if your note is in the wrong location. + 3. Try listing your notes with listnotes and check if your note is there, maybe you renamed it. + 4. Try navigating into your Notes folder, then showing hidden files. Maybe the note is hidden. + + diff --git a/shellnotes.sh b/shellnotes.sh index 049d8dd..3a3cc01 100644 --- a/shellnotes.sh +++ b/shellnotes.sh @@ -4,7 +4,6 @@ #remember to write this line into your terminal #chmod +x shellnotes.sh - #Make a Notes folder for the user cd ~ if [[ -d "Notes" ]]; then @@ -13,8 +12,6 @@ else mkdir Notes; fi - - #opening a note (It will create a new note if $notename is blank) function readnote() { dir="$(pwd)"; @@ -52,12 +49,9 @@ function quickread() { else clear; echo "No such note."; - cd ~ - + cd ~ fi - cd $dir - } #A quick solution to users who want keeping notes instantly via terminal. @@ -105,21 +99,31 @@ echo "-----------------------------------"; #Delete notes from terminal function delnote() { - dir="$(pwd)"; - cd ~/Notes - me="$(whoami)"; - read -p "Enter the name of the note you want to delete: " delete - if [ -e $delete ]; then - rm $delete + if [[ $1 == "-all" ]]; then + dir="$(pwd)"; + cd ~/Notes + me="$(whoami)"; + rm * clear; cd $dir; - echo "Note deleted from Home/$me/Notes"; - echo "-----------------------------------"; + echo "All files deleted from Home/$me/Notes"; + echo "-------------------------------------"; else - echo "No such file." - cd ~; + dir="$(pwd)"; + cd ~/Notes + me="$(whoami)"; + read -p "Enter the name of the note you want to delete: " delete + if [ -e $delete ]; then + rm $delete + clear; + cd $dir; + echo "Note deleted from Home/$me/Notes"; + echo "-----------------------------------"; + else + echo "No such file." + cd ~; fi - +fi } #list your notes via terminal. @@ -134,9 +138,8 @@ function listnotes() { #Help for new users function shellnotes() { if [[ $1 == "-v" ]]; then - echo "Shellnotes version: 1.2" - elif [[ $2 == "--version" ]]; then - echo "Shellnotes version: 1.2" + echo "Shellnotes version: 2.0" + elif [[ $1 == "-r" ]]; then echo "Github repository: https://github.com/dmarakom6/shellnotes/blob/master/" @@ -162,3 +165,51 @@ fi cd $dir } +#Help the user find a specific Note in his note folder. If it's not there, he must have misplaced it. +function findnote() { + dir="$(pwd)" + me="$(whoami)" + read -p "Enter note name: " notename; + cd ~/Notes + if [ -e $notename ]; then + echo "File was found in your Notes folder." + else + echo "File was not found in your Notes folder, must be misplaced or renamed." + echo "Try 'findmisplacednote' to find the original file." + + fi + cd $dir + +} + +#Find a misplaced note, not in the Notes folder. +function findmisplacednote() { + read -p "Enter note name: " notename; + echo "Possible locations: "; + find ~/ -iname $notename -print 2>/dev/null; +} + +#Rename a note. +function renamenote() { + dir="$(pwd)" + me="$(whoami)" + cd ~/Notes + read -p "Enter note name: " notename + if [ -e $notename ]; then + read -p "Enter new name: " newnotename + if [ -e $newnotename ]; then + echo "There is another note named '$newnotename' in your Notes folder." + else + mv $notename $newnotename + clear; + echo "Note renamed from $notename to $newnotename in Home/$me/Notes" + echo "-------------------------------------------------------------" + fi + + else + echo "This note does not exist." + fi + + cd $dir; +} +