Organize files

This commit is contained in:
dmarakom6 2021-07-05 11:50:01 +03:00
parent 2970369d42
commit c9827f2dcd
38 changed files with 532 additions and 345 deletions

View file

@ -5,7 +5,7 @@ Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text. in /docs/github/ for its full text.
info info
NOTES_EDITOR="$(eval cat ~/.shellnotes/util/sd/sd-input1.txt)" NOTES_EDITOR="$(eval cat ~/.shellnotes/util/shellnotes/sd/sd-input1.txt)"
QUICK_NOTES_EDITOR="$(eval cat ~/.shellnotes/util/sd/sd-input2.txt)" QUICK_NOTES_EDITOR="$(eval cat ~/.shellnotes/util/shellnotes/sd/sd-input2.txt)"
DEFAULT_PATH="$(eval echo $(cat ~/.shellnotes/util/sd/sd-input3.txt))" DEFAULT_PATH="$(eval echo $(cat ~/.shellnotes/util/shellnotes/sd/sd-input3.txt))"

View file

@ -1,36 +1,19 @@
.\" Manpage for shellnotes-delnote. .\" Manpage for delnote
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "delnote man page"
.TH delnote 1
.SH NAME .SH NAME
shellnotes-delnote \- Delete a note in your notes folder. shellnotes-delnote \- Delete a note in your notes folder.
.SH SYNOPSIS .SH SYNOPSIS
.PP delnote [FILENAME] [OPTION]
.B delnote
.IR [FILE...]
.PP
.B delnote
.IR [FILE...]
[\fIOPTION\fR]
.PP
.B delnote
[\fIOPTION\fR]
.SH DESCRIPTION .SH DESCRIPTION
delnote() finds and removes the desired note or all the notes from your notes folder.
.B delnote
finds and removes the desired note (or all the notes) from your notes folder.
.SH OPTIONS .SH OPTIONS
[FILENAME] \- The name of the note to delete.
.TP \fR \or\fR
.BR \-all [-all] \- Delete all notes.
Delete all notes. \fR \or\fR
leave a blank parameter ("delnote") and shellnotes will ask you for the filename with an input.
.\".SH BUGS .SH BUGS
If the default path for delnote() is not valid, the program is likely to return an error.
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,30 +1,16 @@
.\" Manpage for shellnotes-findmisplacednote. .\" Manpage for findmisplacednote
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "findmisplacednote man page"
.TH findmisplacednote 1
.SH NAME .SH NAME
shellnotes-findmisplacednote \- Find a note missing from your notes folder. shellnotes-findmisplacednote \- Find a note missing from your notes folder.
.SH SYNOPSIS .SH SYNOPSIS
.PP findmisplacednote [FILENAME]
.B findmisplacednote
.IR [FILE...]
.SH DESCRIPTION .SH DESCRIPTION
findmisplacednote() uses find (do "man find") to check if a note exists in the user's system. This command must be run only when findnote (do "man findnote") doesn't result in an existing note.
.B findmisplacednote .SH OPTIONS
uses find (do "man find") to check if a note exists in the user's system. [FILENAME] \- The name of the note.
This command must be run only when findnote (do "man findnote") doesn't result in an existing note. leave a blank parameter ("findmisplacednote") and shellnotes will ask you for the filename with an input.
.SH BUGS
.\".SH OPTIONS No known bugs.
.\".SH BUGS
.\".TP
.\".BR \Withoutstringbug ", " \-wsBug ", " \72
.\"If there are no matches in the input, "notegrep -ws" will display the file as is.
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,30 +1,16 @@
.\" Manpage for shellnotes-findnote. .\" Manpage for findnote
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "findnote man page"
.TH findnote 1
.SH NAME .SH NAME
shellnotes-findnote \- Find a note in your notes folder. shellnotes-findnote \- Find a note in your notes folder.
.SH SYNOPSIS .SH SYNOPSIS
.PP findnote [FILENAME]
.B findnote
.IR [FILE...]
.SH DESCRIPTION .SH DESCRIPTION
findnote() checks if a note exists in your notes folder.
.B findnote .SH OPTIONS
checks if a note exists in your notes folder using the "find" command. This is a handy command for users with numerous notes who would just like to know whether a note actually exists in their notes folder. [FILENAME] \- The name of the note.
leave a blank parameter ("findnote") and shellnotes will ask you for the filename with an input.
.\".SH OPTIONS .SH BUGS
No known bugs.
.\".SH BUGS
.\".TP
.\".BR \Withoutstringbug ", " \-wsBug ", " \72
.\"If there are no matches in the input, "notegrep -ws" will display the file as is.
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,42 +1,18 @@
.\" Manpage for shellnotes-listnotes. .\" Manpage for listnotes.
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "listnotes man page"
.TH listnotes 1
.SH NAME .SH NAME
shellnotes-listnotes \- List your notes in your note folder from wherever you are.
shellnotes-listnotes \- list your notes from wherever you are.
.SH SYNOPSIS .SH SYNOPSIS
.PP listnotes
.B listnotes
[\fIOPTION\fR]
.SH DESCRIPTION .SH DESCRIPTION
listnotes() uses ls (do "man ls") to list all your notes.
.B listnotes
uses ls (do "man ls") to list all your notes in different ways.
.SH OPTIONS .SH OPTIONS
-d or --dynamic \- Dynamic view of all your notes and their content.
.TP -n or --number \- Number of notes in your notes folder.
.BR \-d ", " \--dynamic -f or --folder \- The current Notes folder.
Dynamic view of all your notes and their content. leave a blank parameter ("listnotes") and shellnotes will show a regular list of your notes.
.TP
.BR \-n ", " \--number
Count the number of notes in your notes folder.
.TP
.BR \-f ", " \--folder
Show the current default notes folder.
.SH BUGS .SH BUGS
If the default path for listnotes() is not valid, the program is likely to crash.
.\".TP
.\".BR \-
.\".PP
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,29 +1,16 @@
.\" Manpage for shellnotes-newnote. .\" Manpage for newnote
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "newnote man page"
.TH newnote 1
.SH NAME .SH NAME
shellnotes-newnote \- Write a new note using your text editor.
shellnotes-newnote \- write a new note using your text editor.
.SH SYNOPSIS .SH SYNOPSIS
.PP newnote [FILENAME]
.B newnote
.IR [FILE...]
.SH DESCRIPTION .SH DESCRIPTION
newnote() uses your default text-editor to write a new note and saves it into your notes folder when finished.
.B newnote .SH OPTIONS
uses your default text-editor to write a new note and saves it into your notes folder when finished. [FILENAME] \- The name of the new note.
leave a blank parameter ("newnote") and shellnotes will ask you for the filename with an input.
.\" .SH OPTIONS
.SH BUGS .SH BUGS
If the default editor for newnote() is not valid, the program is likely to crash.
.TP
.BR \-noSaveBug ", " \-nsBug ", " \110
If the text editor is closed without saving the new file, newnote diplays "Note saved...", but the file is not really saved.
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,27 +1,16 @@
.\" Manpage for shellnotes-notewc. .\" Manpage for notewc
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "notewc man page"
.TH notewc 1
.SH NAME .SH NAME
shellnotes-notewc \- Get info about a note in your notes folder.
shellnotes-notewc \- get info about a note.
.SH SYNOPSIS .SH SYNOPSIS
.PP notewc [FILENAME]
.B notewc
.IR [FILE...]
.SH DESCRIPTION .SH DESCRIPTION
notewc() uses wc (do "man wc") to show (lines/words/chars/name) of a note.
.B notewc .SH OPTIONS
uses wc (do "man wc") to show lines, words, chars and name of a note. [FILENAME] \- The name of the note.
leave a blank parameter ("notewc") and shellnotes will ask you for the filename with an input.
.SH BUGS
.\".SH OPTIONS If wc is not pre-installed the command won't work.
.\".SH BUGS
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com) Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,27 +1,16 @@
.\" Manpage for shellnotes-quicknote. .\" Manpage for quicknote.
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "quicknote man page"
.TH quicknote 1
.SH NAME .SH NAME
shellnotes-quicknote \- Write a new note directly via terminal.
shellnotes-quicknote \- write a new note directly via terminal.
.SH SYNOPSIS .SH SYNOPSIS
.PP quicknote [FILENAME]
.B quicknote
.IR [FILE...]
.SH DESCRIPTION .SH DESCRIPTION
quicknote() uses your in-terminal text-editor to write a new note and saves it into your notes folder when finished.
.B quicknote .SH OPTIONS
uses your in-terminal text-editor to write a new note and saves it into your notes folder when finished. [FILENAME] \- The name of the new note.
It works well with the nano editor. leave a blank parameter ("quicknote") and shellnotes will ask you for the filename with an input.
.SH BUGS
.\".SH OPTIONS If the default editor for quicknote() is not valid, the program is likely to crash.
.\".SH BUGS
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,34 +1,16 @@
.\" Manpage for quickread. .\" Manpage for quickread.
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "quickread man page"
.TH quickread 1
.SH NAME .SH NAME
shellnotes-quickread \- Read new note directly in your terminal. shellnotes-quickread \- Read new note directly in your terminal.
.SH SYNOPSIS .SH SYNOPSIS
.PP quickread [FILENAME]
.B notegrep
[\fIOPTION\fR]
.IR [FILE...]
.SH DESCRIPTION .SH DESCRIPTION
quickread() uses cat (do "man cat") to view a note.
.B quickread .SH OPTIONS
uses cat (do "man cat") to view a note. It only runs inside your notes folder. [FILENAME] \- The name of the note.
leave a blank parameter ("quickread") and shellnotes will ask you for the filename with an input.
.\".SH OPTIONS .SH BUGS
No known bugs.
.TP
.BR \-sc ", " \--split-char =\fISTRING\fR
Split the note on a string or character and then display it.
.\".SH BUGS
.\".TP
.\".BR \Withoutstringbug ", " \-wsBug ", " \72
.\"If there are no matches in the input, "notegrep -ws" will display the file as is.
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,31 +1,16 @@
.\" Manpage for shellnotes-readnote. .\" Manpage for readnote.
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "readnote man page"
.TH readnote 1
.SH NAME .SH NAME
shellnotes-readnote \- Read a note using your text editor.
shellnotes-readnote \- read a note using your favourite text editor.
.SH SYNOPSIS .SH SYNOPSIS
.PP readnote [FILENAME]
.B readnote
.IR [FILE...]
.SH DESCRIPTION .SH DESCRIPTION
readnote() uses your default text-editor to read a note.
.B readnote .SH OPTIONS
uses your default text-editor to read a note. [FILENAME] \- The name of the note.
leave a blank parameter ("readnote") and shellnotes will ask you for the filename with an input.
.\".SH OPTIONS
.SH BUGS .SH BUGS
If the default editor for readnote() is not valid, the program is likely to crash.
.TP
.BR \-nonReadOnlyMode", " \-nrmBug ", " \114
.PP
readnote does not launch the text editor in read-only mode, giving the user permission to make changes.
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,27 +1,17 @@
.\" Manpage for shellnotes-renamenote. .\" Manpage for renamenote
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "renamenote man page"
.TH renamenote 1
.SH NAME .SH NAME
shellnotes-renamenote \- Rename a note in your notes folder.
shellnotes-renamenote \- rename a note in your notes folder.
.SH SYNOPSIS .SH SYNOPSIS
.PP renamenote [FILENAME] [NEW_FILENAME]
.B renamenote
.IR [FILE...]
.IR new_[FILE...]
.SH DESCRIPTION .SH DESCRIPTION
renamenote() uses mv (do "man mv") to rename a note in your default notes folder
.B renamenote .SH OPTIONS
uses mv (do "man mv") to rename a note in your default notes folder. [FILENAME] \- The name of the note.
[NEW_FILENAME] \- The new name of the note
.\".SH OPTIONS leave a blank parameter ("renamenote") and shellnotes will ask you for the filename and the new filename with an input.
.SH BUGS
.\".SH BUGS No known bugs.
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -1,61 +1,22 @@
.\" Manpage for shellnotes. .\" Manpage for shellnotes.
.\" Contact dmarakom@gmail.com to correct errors or typos. .\" Contact dmarakom@gmail.com to correct errors or typos.
.TH man 8 "30/12/2020" "" "shellnotes man page"
.TH shellnotes 1
.SH NAME .SH NAME
shellnotes \- An easy, simple and fast way to keep notes directly via terminal.
shellnotes \- an easy, simple and fast way to keep notes directly via terminal.
.SH SYNOPSIS .SH SYNOPSIS
.PP shellnotes [OPTION]
.B shellnotes
[\fROPTION\fR]
.SH DESCRIPTION .SH DESCRIPTION
Shellnotes is a note system for advanced linux and terminal users. It is made out of a lot of other commands and scripts, so if you want to get information and help for every single one of them, you should visit the Help Page (~/.shellnotes/docs/help manually, or type shellnotes --help in the terminal).
.B shellnotes
is a note system for advanced linux and terminal users. With this tool, you can wither write, read, rename or delete your notes safely and rapidly.
Shellnotes also has numerous other features and subtools, that can help every user on a daily basis.
.SH OPTIONS .SH OPTIONS
-u or --update \- Update shellnotes.
.TP -v or --version \- Display the current version.
.BR \-i ", " \--info -h or --help \- Display help from the Help Page.
Get info about shellnotes, as well as a copyright notice. -r \- View the github repository of the program.
-sd or --set-defaults \- Set default editors and folder for writing and storing your notes.
.TP -au or --auto-update \- Toggle the auto-update feature.
.BR \-v ", " \--version -l or --logs \- Open a logfile.
Displays your current version of shellnotes. leave a blank parameter ("shellnotes") for checking if shellnotes is installed correctly.
.SH BUGS
.TP No known bugs.
.BR \-r ", " \--repository
Get info about the project's github repository.
.TP
.BR \-h ", " \--help
Enter the Shellnotes Help Page (SHP).
.TP
.BR \-u ", " \--update
Searches for an update and applies it on shellnotes if necessary.
.TP
.BR \-au ", " \--auto-update
Toggle the auto-update feature.
Shellnotes auto-update searches for a new a new update in the project's github repository every time you open your terminal and asks you whether to apply it or not.
.TP
.BR \-sd ", " \--set-defaults
Redirects the user to the shellnotes configuration tool (set_defaults.sh)
.TP
.BR \-l ", " \--logs
View a logfile.
.\".SH BUGS
.SH AUTHOR .SH AUTHOR
Dimitris Marakomihelakis (dmarakom@gmail.com)
Dimitris Marakomihelakis (dmarakom@gmail.com)

View file

@ -17,9 +17,9 @@ echo "3. Select default path for saving your notes (Notes folder)"
echo "4. View defaults (editors, folder, source)" echo "4. View defaults (editors, folder, source)"
echo echo
echo -n "[1,2,3,4]: " && read input echo -n "[1,2,3,4]: " && read input
input1="$(cat ~/.shellnotes/util/sd/sd-input1.txt)" input1="$(cat ~/.shellnotes/util/shellnotes/sd/sd-input1.txt)"
input2="$(cat ~/.shellnotes/util/sd/sd-input2.txt)" input2="$(cat ~/.shellnotes/util/shellnotes/sd/sd-input2.txt)"
input3="$(cat ~/.shellnotes/util/sd/sd-input3.txt)" input3="$(cat ~/.shellnotes/util/shellnotes/sd/sd-input3.txt)"
@ -29,7 +29,7 @@ if [[ "$input" == "1" ]]; then
if [[ "$(which $name)" == "$input1" ]]; then if [[ "$(which $name)" == "$input1" ]]; then
echo "This is already the default notes editor." echo "This is already the default notes editor."
else else
echo "$(which $name)" > ~/.shellnotes/util/sd/sd-input1.txt echo "$(which $name)" > ~/.shellnotes/util/shellnotes/shellnotes/sd/sd-input1.txt
echo "Default notes editor updated." echo "Default notes editor updated."
echo "Please restart your terminal." echo "Please restart your terminal."
fi fi
@ -48,7 +48,7 @@ elif [[ "$input" == "2" ]]; then
if [[ "$(which $name)" == "$input2" ]]; then if [[ "$(which $name)" == "$input2" ]]; then
echo "This is already the default quick notes editor." echo "This is already the default quick notes editor."
else else
echo "$(which $name)" > ~/.shellnotes/util/sd/sd-input2.txt echo "$(which $name)" > ~/.shellnotes/util/shellnotes/sd/sd-input2.txt
echo "Default quick notes editor updated." echo "Default quick notes editor updated."
echo "Please restart your terminal." echo "Please restart your terminal."
fi fi
@ -70,7 +70,7 @@ elif [[ "$input" == "3" ]]; then
./sdfailed ./sdfailed
else else
mv $DEFAULT_PATH/* $name mv $DEFAULT_PATH/* $name
echo "$name" > ~/.shellnotes/util/sd/sd-input3.txt echo "$name" > ~/.shellnotes/util/shellnotes/sd/sd-input3.txt
echo "Default notes folder updated." echo "Default notes folder updated."
echo "Please restart your terminal." echo "Please restart your terminal."
fi fi

View file

@ -1,9 +1,3 @@
#The first line is the user's default shell found during installation process.
#Warning! If you don't have gedit(text editor) or nano installed, you may have to change the default text editor.
#The lines below must NOT be changed.
DIR="$(pwd)" DIR="$(pwd)"
. ~/.shellnotes/util/getv.sh . ~/.shellnotes/util/getv.sh
. ~/.shellnotes/def/defaults.sh . ~/.shellnotes/def/defaults.sh
@ -25,3 +19,4 @@ DIR="$(pwd)"
. ~/.shellnotes/util/shellnotes.sh . ~/.shellnotes/util/shellnotes.sh
. ~/.shellnotes/util/.hidden/.clearlogs.sh . ~/.shellnotes/util/.hidden/.clearlogs.sh
. ~/.shellnotes/util/.hidden/.resetshellnotes.sh . ~/.shellnotes/util/.hidden/.resetshellnotes.sh

View file

@ -10,9 +10,9 @@ function resetshellnotes() {
proceed() { proceed() {
echo "y\n" | clearlogs >/dev/null echo "y\n" | clearlogs >/dev/null
echo "" > ~/.shellnotes/util/listnotes/output/* echo "" > ~/.shellnotes/util/listnotes/output/*
echo "/usr/bin/gedit" > ~/.shellnotes/util/sd/sd-input1.txt echo "/usr/bin/gedit" > ~/.shellnotes/util/shellnotes/sd/sd-input1.txt
echo "/bin/nano"> ~/.shellnotes/util/sd/sd-input2.txt echo "/bin/nano"> ~/.shellnotes/util/shellnotes/sd/sd-input2.txt
echo "~/Notes" > ~/.shellnotes/util/sd/sd-input3.txt echo "~/Notes" > ~/.shellnotes/util/shellnotes/sd/sd-input3.txt
sed -i '1d' ~/.shellnotes/.shellnotes.sh sed -i '1d' ~/.shellnotes/.shellnotes.sh
} }

View file

@ -29,8 +29,8 @@ class cd:
os.chdir(self.savedPath) os.chdir(self.savedPath)
folder = "cat ~/.shellnotes/util/sd/sd-input3.txt" folder = "cat ~/.shellnotes/util/shellnotes/sd/sd-input3.txt"
files = "eval echo $(cat ~/.shellnotes/util/sd/sd-input3.txt) | xargs ls | wc -l" files = "eval echo $(cat ~/.shellnotes/util/shellnotes/sd/sd-input3.txt) | xargs ls | wc -l"
os.system(folder + "> ~/.shellnotes/util/listnotes/output/dir.txt 2> ~/.shellnotes/util/listnotes/output/direrr.txt") os.system(folder + "> ~/.shellnotes/util/listnotes/output/dir.txt 2> ~/.shellnotes/util/listnotes/output/direrr.txt")

View file

@ -5,7 +5,7 @@ Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text. in /docs/github/ for its full text.
info info
folder="$(cat ~/.shellnotes/util/sd/sd-input3.txt)" folder="$(cat ~/.shellnotes/util/shellnotes/sd/sd-input3.txt)"
files="$(eval echo $(cat ~/.shellnotes/util/sd/sd-input3.txt) | xargs ls | wc -l)" files="$(eval echo $(cat ~/.shellnotes/util/shellnotes/sd/sd-input3.txt) | xargs ls | wc -l)"
echo "Found $files files in $folder." echo "Found $files files in $folder."

View file

@ -125,23 +125,23 @@ function notegrep() {
case $option in case $option in
-sc | --split-char) -sc | --split-char)
. ~/.shellnotes/util/notegrep/sc.sh . ~/.shellnotes/util/notegrep/sc/sc.sh
;; ;;
-cl | --count-lines ) -cl | --count-lines )
. ~/.shellnotes/util/notegrep/cl.sh . ~/.shellnotes/util/notegrep/cl/cl.sh
;; ;;
-sl | --show-lines ) -sl | --show-lines )
. ~/.shellnotes/util/notegrep/sl.sh . ~/.shellnotes/util/notegrep/sl/sl.sh
;; ;;
-ws | --without-string ) -ws | --without-string )
. ~/.shellnotes/util/notegrep/ws.sh . ~/.shellnotes/util/notegrep/ws/ws.sh
;; ;;
-m | --multiple ) -m | --multiple )
cd ~ cd ~
if [ "$(python3 ~/.shellnotes/util/notegrep/m.py $regex $notename | wc -l)" -ge 25 ]; then if [ "$(python3 ~/.shellnotes/util/notegrep/m/m.py $regex $notename | wc -l)" -ge 25 ]; then
python3 ~/.shellnotes/util/notegrep/m.py $regex $notename | less -R python3 ~/.shellnotes/util/notegrep/m/m.py $regex $notename | less -R
else else
python3 ~/.shellnotes/util/notegrep/m.py $regex $notename python3 ~/.shellnotes/util/notegrep/m/m.py $regex $notename
fi fi
cd $DIR cd $DIR
;; ;;
@ -176,12 +176,12 @@ function notegrep() {
-cf | --count-files ) -cf | --count-files )
export regex=$2 export regex=$2
export option=$1 export option=$1
. ~/.shellnotes/util/notegrep/cf.sh . ~/.shellnotes/util/notegrep/cf/cf.sh
;; ;;
-sf | --show-files ) -sf | --show-files )
export regex=$2 export regex=$2
export option=$1 export option=$1
. ~/.shellnotes/util/notegrep/sf.sh . ~/.shellnotes/util/notegrep/sf/sf.sh
;; ;;
-sc | --split-char | -cl | --count-lines | -sf | --show-lines | -ws | --without-string | -m | --multiple) -sc | --split-char | -cl | --count-lines | -sf | --show-lines | -ws | --without-string | -m | --multiple)
echo "Invalid use of parameter '$regex'.\nUsage:\nnotegrep [PATTERN] file...\nnotegrep [OPTION] [PATTERN] file...\nnotegrep [OPTION] file...\nnotegrep [OPTION] [PATTERN]" echo "Invalid use of parameter '$regex'.\nUsage:\nnotegrep [PATTERN] file...\nnotegrep [OPTION] [PATTERN] file...\nnotegrep [OPTION] file...\nnotegrep [OPTION] [PATTERN]"

23
util/notegrep/cf/cf.sh Normal file
View file

@ -0,0 +1,23 @@
:<<'info'
shellnotes - cf.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
files="$(grep -rwl $regex $DEFAULT_PATH/* | wc -l)"
if [ $files -eq 1 ]; then
echo "Found $files matching file in $DEFAULT_PATH."
elif [ $files -gt 1 ]; then
echo "Found $files matching files in $DEFAULT_PATH."
echo -n "Show files?(Y/N): " && read show
case $show in
yes | y | Y | YES | Yes )
grep -rwl $regex $DEFAULT_PATH/*
;;
esac
else
echo "No matching files found."
fi

30
util/notegrep/cl/cl.sh Normal file
View file

@ -0,0 +1,30 @@
:<<'info'
shellnotes - cl.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
if [ -f $DEFAULT_PATH/$notename ]; then
out="$(grep -c $regex $DEFAULT_PATH/$notename)"
if [ $out -eq 1 ]; then
echo "Compressed $out line of grep output."
elif [ $out -gt 1 ]; then
echo "Compressed $out lines of grep output."
echo -n "Show lines?(Y/N): " && read show
case $show in
yes | y | Y | YES | Yes )
grep -n $regex $DEFAULT_PATH/$notename
;;
esac
else
echo "No matching lines found."
fi
else
echo "No such file."
return 0
fi

69
util/notegrep/m/m.py Normal file
View file

@ -0,0 +1,69 @@
#!/usr/bin/env python3
#shellnotes - m.py
#(C) Dimitris Marakomihelakis
#Released under the "All rights reserved" category. See the RIGHTS.txt file
#in /docs/github/ for its full text.
import sys
import os.path
from os import path
import subprocess
from subprocess import check_output
import re
class Multi():
def __init__(self, patterns, files):
self.patterns = patterns
self.files = files
def check_empty(self):
if "" in self.patterns: raise IndexError #asks for direct input
def remove_duplicates(self):
self.patterns, self.files = list(dict.fromkeys(self.patterns)), list(dict.fromkeys(self.files))
def remove_spaces(self):
self.patterns, self.files = [elem.strip(' ') for elem in self.patterns], [elem.strip(' ') for elem in self.files]
def split_extras(self): #not using this for now
if len(sys.argv) == 4:
if "-i" in sys.argv[-1] or "--ignore" in sys.argv[-1]:
re.sub(r'\s(--\ignore+|-\i)', '', sys.sys.argv[-1]) #remove everything from sys.argv[-1], except "-i" or "--ignore", if it exists.
def print_matches(self):
for file in self.files:
try:
if file == "": return 0
print("\n"+file if path.exists('Notes/'+file) else f"\n{file} (not found):", flush=True)
print("=" * len(file) if path.exists('Notes/'+file) else "-", flush=True)
with open('Notes/'+file, 'r') as f:
text = f.read()
for pattern in self.patterns:
if re.search(pattern, text):
out = os.system(f"""echo -n "'\033[1;35;40m{pattern}\033[0;37;0m'": && grep -n --color=always {pattern} Notes/{file}""")
except FileNotFoundError: pass
def main():
try:
newMulti = Multi(sys.argv[1].split(','), sys.argv[2].split(','))
newMulti.check_empty()
newMulti.remove_spaces()
newMulti.remove_duplicates()
newMulti.print_matches()
except IndexError:
patterns = input("Enter patterns, separated by a comma: ")
files = input("Enter files, separated by a comma: ")
newMulti = Multi(patterns.split(','), files.split(','))
newMulti.remove_spaces()
newMulti.remove_duplicates()
newMulti.print_matches()
if __name__ == "__main__":
main()

30
util/notegrep/sc/sc.sh Normal file
View file

@ -0,0 +1,30 @@
:<<'info'
shellnotes - sc.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
if [ -f $DEFAULT_PATH/$notename ]; then
if grep -q $regex $DEFAULT_PATH/$notename; then
out="$(cat $DEFAULT_PATH/$notename | sed s/$regex/\\n/g | wc -l)"
if [ $out -gt 20 ]; then
cat $DEFAULT_PATH/$notename | sed s/$regex/\\n/g | less
elif [ $out -le 20 ]; then
cat $DEFAULT_PATH/$notename | sed s/$regex/\\n/g
fi
else
echo "No matches found."
return 0
fi
else
echo "This note doesn't exist."
return 0
fi

14
util/notegrep/sf/sf.sh Normal file
View file

@ -0,0 +1,14 @@
:<<'info'
shellnotes - sf.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
files="$(grep -rwl $regex $DEFAULT_PATH/* | wc -l)"
if [ $files -ge 1 ]; then
grep -rwl $regex $DEFAULT_PATH/*
else
echo "No matching files found."
fi

19
util/notegrep/sl/sl.sh Normal file
View file

@ -0,0 +1,19 @@
:<<'info'
shellnotes - sl.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
if [ -f $DEFAULT_PATH/$notename ]; then
out="$(grep -n $regex $DEFAULT_PATH/$notename | wc -l)"
if [ $out -eq 0 ]; then
echo "No matching lines found."
else
grep -n $regex $DEFAULT_PATH/$notename
fi
else
echo "No such file."
fi

50
util/notegrep/ws/ws.sh Normal file
View file

@ -0,0 +1,50 @@
:<<'info'
shellnotes - ws.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
grepv() { #the command run when input is valid
if [ $(grep -v $regex $DEFAULT_PATH/$notename | wc -l) -ge 20 ]; then
grep -v $regex $DEFAULT_PATH/$notename | less
else
grep -v $regex $DEFAULT_PATH/$notename
fi
}
nomatch() {
echo -n "There are no matches.\nView note anyway?(Y/N): " && read view
case $view in
y | Y | yes | YES | Yes )
if [ $(cat $DEFAULT_PATH/$notename | wc -l) -ge 20 ]; then
less $DEFAULT_PATH/$notename
else
cat $DEFAULT_PATH/$notename
fi
return 0
;;
*)
echo "Cancelled."
return 0
;;
esac
}
if [ -f $DEFAULT_PATH/$notename ]; then
if grep -vq $regex $DEFAULT_PATH/$notename ; then
test "$(cat $DEFAULT_PATH/$notename)" = "$(grep -v $regex $DEFAULT_PATH/$notename)" && nomatch || grepv && return 0
else
echo "Pattern matches the whole file."
return 0
fi
else
echo "This note doesn't exist."
return 0
fi

View file

@ -6,14 +6,14 @@ in /docs/github/ for its full text.
info info
function shellnotes() { function shellnotes() {
. ~/.shellnotes/util/h/h.sh . ~/.shellnotes/util/shellnotes/h/h.sh
. ~/.shellnotes/util/v/v.sh . ~/.shellnotes/util/shellnotes/v/v.sh
. ~/.shellnotes/util/r/r.sh . ~/.shellnotes/util/shellnotes/r/r.sh
. ~/.shellnotes/util/u/u.sh . ~/.shellnotes/util/shellnotes/u/u.sh
. ~/.shellnotes/util/l/l.sh . ~/.shellnotes/util/shellnotes/l/l.sh
. ~/.shellnotes/util/au/au.sh . ~/.shellnotes/util/shellnotes/au/au.sh
. ~/.shellnotes/util/sd/sd.sh . ~/.shellnotes/util/shellnotes/sd/sd.sh
. ~/.shellnotes/util/i/i.sh . ~/.shellnotes/util/shellnotes/i/i.sh
if [[ $# > 1 ]]; then if [[ $# > 1 ]]; then
echo "Too many arguments." echo "Too many arguments."
elif [[ $# = 0 ]];then elif [[ $# = 0 ]];then

30
util/shellnotes/au/au.sh Normal file
View file

@ -0,0 +1,30 @@
:<<'info'
shellnotes - au.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
case $1 in -au|--auto-update )
if grep -q 'ChUpd.sh' ~/.shellnotes/.shellnotes.sh; then
echo "auto-update feature is enabled."
echo -n "Disable it? [Y/N]: " && read input
case $input in Yes|y|Y|yes|YES )
sed -i '/ChUpd.sh/d' ~/.shellnotes/.shellnotes.sh
echo "auto-update is now disabled."
echo "To enable, run 'shellnotes -au' again."
esac
else
echo "auto-update feature is disabled."
echo -n "Enable it? [Y/N]: " && read input
case $input in Yes|y|Y|yes|YES )
long=$(grep -n "#The lines below must NOT be changed." ~/.shellnotes/.shellnotes.sh)
short=$(echo "${long}" | head -c1)
short=$`$short+1` 2>/dev/null
file=$(eval echo "~/.shellnotes/util/ChUpd.sh")
sed -i "$short i\. $file" ~/.shellnotes/.shellnotes.sh
echo "auto-update is now enabled."
echo "To disable, run 'shellnotes -au' again."
esac
fi
esac

11
util/shellnotes/h/h.sh Normal file
View file

@ -0,0 +1,11 @@
:<<'info'
shellnotes - h.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
case $1 in -h|--help )
less ~/.shellnotes/docs/help
cd $DIR
esac

11
util/shellnotes/i/i.sh Normal file
View file

@ -0,0 +1,11 @@
:<<'info'
shellnotes - i.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
case $1 in -i|--i )
echo "This is an original copy of the shellnotes project from the github repository."
echo "Copyright © Dimitris Marakomihelakis. All rights reserved."
esac

44
util/shellnotes/l/l.sh Normal file
View file

@ -0,0 +1,44 @@
:<<'info'
shellnotes - l.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
case $1 in -l|--logs )
clear
echo "Please select a logfile to open"
echo "-------------------------------"
echo
echo "1. disablement errors"
echo "2. enablement errors"
echo "3. installation errors"
echo "4. update errors"
echo "5. uninstallation errors"
echo "6. set-defaults errors"
echo
echo "For more info about which one to choose, read /docs/system/loggingsystem.txt"
echo
echo -n "[1,2,3,4,5]: " && read input
if [ -z $input ]; then
echo "Invalid input."
return 0
else
if [ $input = 1 ]; then
less ~/.shellnotes/logs/disfailed.txt
elif [ $input = 2 ]; then
less ~/.shellnotes/logs/enfailed.txt
elif [ $input = 3 ]; then
less ~/.shellnotes/logs/ifailed.txt
elif [ $input = 4 ]; then
less ~/.shellnotes/logs/ufailed.txt
elif [ $input = 5 ]; then
less ~/.shellnotes/logs/uninfailed.txt
elif [ $input = 6 ]; then
less ~/.shellnotes/logs/sdfailed.txt
else
echo "Invalid input."
fi
fi
esac

10
util/shellnotes/r/r.sh Normal file
View file

@ -0,0 +1,10 @@
:<<'info'
shellnotes - r.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
case $1 in -r|--repository )
echo "Github repository: https://github.com/dmarakom6/shellnotes/blob/master/"
esac

View file

@ -0,0 +1 @@
/usr/bin/gedit

View file

@ -0,0 +1 @@
/bin/nano

View file

@ -0,0 +1 @@
~/Notes

10
util/shellnotes/sd/sd.sh Normal file
View file

@ -0,0 +1,10 @@
:<<'info'
shellnotes - sd.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
case $1 in -sd|--set-defaults )
. ~/.shellnotes/set_defaults.sh
esac

14
util/shellnotes/u/u.sh Normal file
View file

@ -0,0 +1,14 @@
:<<'info'
shellnotes - u.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
case $1 in -u|--update )
if [ -n "`$SHELL -c 'echo $BASH_VERSION'`" ]; then
. ~/.shellnotes/bash_update.sh
else
. ~/.shellnotes/update.sh
fi
esac

10
util/shellnotes/v/v.sh Normal file
View file

@ -0,0 +1,10 @@
:<<'info'
shellnotes - v.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
case $1 in -v|--version )
echo "Shellnotes version: $VER"
esac