Compare commits
20 commits
Author | SHA1 | Date | |
---|---|---|---|
|
406a9756a9 | ||
|
b7defaa83b | ||
|
c2bef3ff06 | ||
|
cb4829ae9e | ||
|
ce08e30b75 | ||
|
7a67a3704b | ||
|
11f7767c09 | ||
|
839bc273c8 | ||
|
96d83574a0 | ||
|
8d59cebdc8 | ||
|
7f710ff006 | ||
|
78be120770 | ||
|
332c70a72d | ||
|
120a7b5555 | ||
|
e4f2d6ceec | ||
|
c9df858313 | ||
|
d77e78b776 | ||
|
927b05c578 | ||
|
2a257bbe62 | ||
|
a569cef447 |
68 changed files with 1510 additions and 359 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1 +1,5 @@
|
|||
**/__pycache__
|
||||
docs/help
|
||||
image/
|
||||
util/loggersrc/
|
||||
|
||||
|
|
|
@ -5,7 +5,18 @@ Released under the "All rights reserved" category. See the RIGHTS.txt file
|
|||
in /docs/github/ for its full text.
|
||||
info
|
||||
|
||||
NOTES_EDITOR="$(eval cat ~/.shellnotes/util/shellnotes/sd/sd-input1.txt)"
|
||||
if [ $(cat "$HOME/.shellnotes/util/shellnotes/sd/sd-input1.txt") = ".shellnotes/sne/sne.py" ]; then
|
||||
function NOTES_EDITOR() {
|
||||
if [ -n "$1" ]; then
|
||||
python3 $(cat $HOME/.shellnotes/util/shellnotes/sd/sd-input1.txt) "$1"
|
||||
else
|
||||
python3 $(cat $HOME/.shellnotes/util/shellnotes/sd/sd-input1.txt)
|
||||
fi
|
||||
}
|
||||
else
|
||||
NOTES_EDITOR() { eval cat $HOME/.shellnotes/util/shellnotes/sd/sd-input1.txt }
|
||||
fi
|
||||
|
||||
QUICK_NOTES_EDITOR="$(eval cat ~/.shellnotes/util/shellnotes/sd/sd-input2.txt)"
|
||||
DEFAULT_PATH="$(eval echo $(cat ~/.shellnotes/util/shellnotes/sd/sd-input3.txt))"
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
auto-update
|
||||
===========
|
||||
|
||||
In shellnotes 3.0 and later, there's a new auto-update feature, coming along with the installation
|
||||
one.
|
||||
In shellnotes 3.0 and later, there's an auto-update feature.
|
||||
After the installation, every time you open your terminal, shellnotes will search for new updates automatically. This might help users that don't want to run "shellnotes -u" every time a new version
|
||||
is released.
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
Basic commands for shellnotes:
|
||||
|
||||
newnote
|
||||
quicknote
|
||||
readnote
|
||||
quickread
|
||||
listnotes (-n/-d/-f)
|
||||
(.)clearlogs
|
||||
clipnote
|
||||
delnote (-all)
|
||||
findnote
|
||||
findmisplacednote
|
||||
renamenote
|
||||
shellnotes (-u/-v/-r/-l/-sd/-h/-au)
|
||||
clearlogs
|
||||
resetshellnotes (-f)
|
||||
noteinfo
|
||||
listnotes (-n/-d/-f/-v)
|
||||
newnote
|
||||
notegrep (-sc/-cl/-cf/-sf/-ws/-m)
|
||||
notewc
|
||||
quicknote (-l/-r/-s)
|
||||
quickread
|
||||
readnote
|
||||
renamenote
|
||||
(.)resetshellnotes (-f)
|
||||
rmdups
|
||||
shellnotes (-u/-v/-r/-l/-sd/-h/-au)
|
|
@ -7,8 +7,3 @@ How to disable (versions 3.0 and higher)
|
|||
making sure all the content of the source code is in the same directory. Then, choose the second
|
||||
(2) option. After restarting your terminal, shellnotes will not be recognised by your shell,
|
||||
until you enable it again, using option three (3).
|
||||
|
||||
About disabling:
|
||||
-Disabling is much safer than uninstalling. The files are kept in your system, but you do not
|
||||
need to reinstall when you want to use the program and you don't risk to damage your shell
|
||||
configuration. (see warnings in help page)
|
|
@ -3,23 +3,20 @@
|
|||
A easy, simple and fast way to keep notes via your linux terminal.
|
||||
|
||||
# What is shellnotes?
|
||||
Shellnotes is a note system for advanced linux and terminal users. It is made out of a lot of other commands and scripts, and has tons of abilities, like a logging system, an auto-update feature, and much more!
|
||||
Shellnotes uses your favourite text editor to save notes on the go. If you are the type of guy that has his terminal open 24/7, you can also save notes __directly__ via terminal!
|
||||
With shellnotes, you can make, find, list, edit or delete your notes from wherever you are, whenever you want.
|
||||
Shellnotes is a command-line note-taking app for linux users. Shellnotes uses your favourite text editor to save notes on the go. With shellnotes, you can make, find, list, edit or delete your notes from wherever you are, whenever you want. You can use a variety of tools to manipulate your notes and extract data from them.
|
||||
|
||||
# Why use shellnotes?
|
||||
#### Here's why:
|
||||
* Shellnotes is the fastest and the safest way to take notes.
|
||||
* It can suit both dynamic and regular users, as it brings a classic TUI experience as well as some more modern abilities.
|
||||
* Shellnotes is open source.
|
||||
* It can suit both dynamic and regular users, as it brings both CLI and GUI experiences.
|
||||
* It runs __exclusively__ in your terminal, its source files are stored in your home folder.
|
||||
* It's lightweight
|
||||
* It's [more than just a program for taking notes.](#learn-everything-shellnotes-can-do). It has a ton of other interesting abilities.
|
||||
* It's portable and compatible with most shells.
|
||||
* It matches all the users' experience, by creating the appropriate environment for both beginners and advanced users linux users.
|
||||
* Even if you delete shellnotes, your notes will stay where they are.
|
||||
* It has a simple file organization system and [TUI](https://en.wikipedia.org/wiki/Text-based_user_interface).
|
||||
* It's easy to install, delete, update or use.
|
||||
* It's mostly written in [shell](https://en.wikipedia.org/wiki/Shell_script), which is the language for Unix/Linux [CLI](https://en.wikipedia.org/wiki/Command-line_interface) applications.
|
||||
* It has a simple file organization system and [CLI](https://en.wikipedia.org/wiki/Command-line_interface).
|
||||
* It's easy to install, delete and update.
|
||||
* It's mostly written in [shell](https://en.wikipedia.org/wiki/Shell_script), which is one of the most commonly used apps to build Linux apps.
|
||||
|
||||
# How to install
|
||||
After downloading the source code, navigate to the folder where it's stored, and execute the install script (`install.sh`), using the `sh` command.
|
||||
|
@ -40,7 +37,7 @@ user@device:~/Downloads$ sh install.sh
|
|||
for more information, make sure to check out the [installation documentation](https://github.com/dmarakom6/shellnotes/blob/master/docs/installing.txt).
|
||||
|
||||
|
||||
# How to set the defaults
|
||||
# How to configure shellnotes
|
||||
Shellnotes lets you use your favourite text-editor to take your notes, and your prefered directory to save your notes, from where shellnotes will delete them, read them, or list them.
|
||||
## How shellnotes works with text-editors
|
||||
There are to ways to write a note with shellnotes:
|
||||
|
@ -48,7 +45,7 @@ There are to ways to write a note with shellnotes:
|
|||
2. Using an in-terminal editor.
|
||||
## The Default Note Editors
|
||||
Shellnotes comes with two default editors, which you can download or [change](#change-default-editors). These are:
|
||||
1. [gedit](https://wiki.gnome.org/Apps/Gedit), the default [GNOME](https://www.gnome.org/) text editor.
|
||||
1. [SnE](https://github.com/dmarakom6/shellnotes/blob/master/docs/sne.md).
|
||||
2. [nano](https://www.nano-editor.org/), for in-terminal notes.
|
||||
|
||||
|
||||
|
@ -57,7 +54,7 @@ Shellnotes __does not__ require the user to have the above editors. You can alwa
|
|||
After installing shellnotes, open your terminal, and type `shellnotes --set-defaults`. This will trigger the [shellnotes configuration tool](https://github.com/dmarakom6/shellnotes/blob/master/set_defaults.sh). Choose an option:
|
||||
1. Select default [GUI](https://en.wikipedia.org/wiki/Graphical_user_interface) editor for regular notes.
|
||||
2. Select in-terminal editor for instant notes.
|
||||
3. Check default editors.
|
||||
3. Select default path for saving your Notes.
|
||||
|
||||
After selecting an option, write ___the name of the program___ you want to set as a new default GUI/terminal editor. It must be valid. (i.e. `code` for VSCode, `subl` for Sublime Text) Shellnotes will automatically locate the program's location and apply the changes. If the name is invalid, the operation will stop.
|
||||
|
||||
|
@ -69,14 +66,13 @@ To change the default note path, type `shellnotes --set-defaults` in the termina
|
|||
Select option 3 to change the default Notes folder, or option 4 to check the current one.
|
||||
If you choose option 3, type a valid __relative__ path to the new directory with permissions given. Shellnotes will automatically change the default folder to the new one. Your notes will be transfered there as well!
|
||||
> Note: You can check the current Notes folder either via "shellnotes -sd, option 4", or "listnotes --folder".
|
||||
|
||||
# Taking your first note
|
||||
You can either use `newnote` for regular notes, or `quicknote` for an in-terminal experience.
|
||||
## Using `newnote`
|
||||
Open a terminal window after installing shellnotes. Type `newnote` and the name of the new note's name. If you don't set a name after the command as a parameter, shellnotes will ask you for it with a dynamic input.
|
||||
It should look like this:
|
||||
```
|
||||
user@device:folder$ newnote helloWorld => no extension needed!
|
||||
user@device:folder$ newnote helloWorld
|
||||
```
|
||||
or:
|
||||
```
|
||||
|
@ -98,7 +94,6 @@ Enter note name: helloWorld
|
|||
`quicknote` will then open the [default quick notes editor](#the-default-note-editors). Now you can start saving your notes via terminal.
|
||||
### Reading notes
|
||||
You can also read your notes in a similar way, using `readnote` and `quickread`. See more in the [commands file](https://github.com/dmarakom6/shellnotes/blob/master/docs/commands.txt).
|
||||
|
||||
# Learn everything shellnotes can do
|
||||
shellnotes is more than just that. Here's some documentation you might be interested in:
|
||||
* [how to delete shellnotes](https://github.com/dmarakom6/shellnotes/blob/master/docs/uninstalling.txt)
|
||||
|
@ -114,10 +109,6 @@ shellnotes is more than just that. Here's some documentation you might be intere
|
|||
* [see what versions are supported](https://github.com/dmarakom6/shellnotes/blob/master/docs/github/SECURITY.md)
|
||||
* [get more info about shellnotes](https://github.com/dmarakom6/shellnotes/blob/master/docs/help)
|
||||
Want even more information? Feel free to see the whole [shellnotes documentation](https://github.com/dmarakom6/shellnotes/blob/master/docs/)!
|
||||
|
||||
|
||||
# Warnings!
|
||||
|
||||
*WARNING*: The default shell for shellnotes is bash. However, shellnotes will find your shell if it's different and continue installing according to it. If your shell is not supported though, the installation will fail.
|
||||
|
||||
*WARNING*: install.sh must be run from the folder where it was downloaded WITH the other files from the repo. Otherwise, installation will fail. (see [installation documentation](https://github.com/dmarakom6/shellnotes/blob/master/docs/installing.txt) for more).
|
|
@ -3,5 +3,6 @@ Permissions for users
|
|||
|
||||
Shellnotes is under the "All rights reserved" category.
|
||||
You can only download the source code, but not change it or sell it.
|
||||
Forks, pull requests and feedback are welcome.
|
||||
There is a copyright notice in every file.
|
||||
For further information, please contact the author at dmarakom@gmail.com .
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions of shellnotes
|
||||
|
||||
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 3.0.x | yes |
|
||||
| 2.5.x | yes* |
|
||||
| 2.3.x | yes* |
|
||||
| 2.0.x | yes* |
|
||||
| 1.2.x | yes* |
|
||||
| 1.1.x | yes* |
|
||||
| 1.0.x | no |
|
||||
| 0.1.x | no |
|
||||
|
||||
*: Installation not supported
|
||||
|
||||
## About updating
|
||||
|
||||
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.
|
|
@ -1,41 +1,42 @@
|
|||
About Installing
|
||||
================
|
||||
|
||||
How to install (versions 2.5 and lower)
|
||||
-This installation is not supported by shellnotes. However, to install, place shellnotes.sh and help into his Home folder. Then, add a dot behind the names of the two files (.shellnotes.sh, .help). This will hide them from your folder. After that, open the terminal and type "chmod +x ~/.shellnotes.sh". This will give permissions to run the program. Finally, open your shell configuration file (ex. bashrc, zshrc) and put this line in the end of the file: "source ~/.shellnotes.sh".
|
||||
|
||||
How to install (versions 3.0 and higher)
|
||||
-This installation is supported. It's an automatic reproduction of the above steps, all included in a single script. Just open the terminal, get to the directory where the files were downloaded and type "sh install.sh" to begin the installation proccess.
|
||||
-It's an automatic reproduction of the steps for lower versions, all included in a single script. Just open the terminal, get to the directory where the files were downloaded and type "sh install.sh" to begin the installation proccess.
|
||||
|
||||
About Installing:
|
||||
-Complete installation instructions for every version of shellnotes are given in the readme file (README.md). Here you will find some more advanced information about installing shellnotes.
|
||||
|
||||
For Other Shell users:
|
||||
Shellnotes supports a variety of shells. The supported shells for installation are:
|
||||
- Bash (Bourne Again Shell)
|
||||
- Zsh
|
||||
- Csh
|
||||
- Ksh
|
||||
- Fish
|
||||
- Bash (Bourne Again Shell) (Most Compatible)
|
||||
- Zsh (Compatible)
|
||||
- Csh (Compatible)
|
||||
- Ksh (Compatible)
|
||||
- Fish (Untested)
|
||||
|
||||
During the installation process, the installation program (install.sh) will find the user's shell and install shellnotes according to the shell's configuration. If your shell is not supported, shellnotes will not be installed.
|
||||
Bash is the default shell for shellnotes. Although it supports others, there might be bugs/problems while running it in a non-bash shell. We highly recommend switching to bash if you want a full experience with shellnotes.
|
||||
If your shell is not one of the above, we recommend installing one on the list.
|
||||
|
||||
For Mac Users:
|
||||
MacOS usually uses bash as its default shell, this means that the program will work properly, but the user will have to change the default path as well as the editors.
|
||||
MacOS usually uses bash as its default shell, however this does not mean that the program will work properly. Compatibility with MacOS hasn't been tested.
|
||||
|
||||
For Windows Users:
|
||||
The only possible way for the user to use shellnotes in a Windows PC, is to install Windows Terminal. Windows Terminal is a multi-tabbed command-line front-end that Microsoft has developed for Windows 10, as a replacement for Windows Console. It can run any command-line app, including all Windows terminal emulators, in a separate tab. It is preconfigured to run Command Prompt, PowerShell, WSL, SSH, and Azure Cloud Shell Connector. If the user changes the default path and text editors, the program might work.
|
||||
The only possible way for the user to use shellnotes in a Windows PC, is to install WSL on Windows Terminal. Windows Terminal is a multi-tabbed command-line front-end that Microsoft has developed for Windows 10, as a replacement for Windows Console. It can run any command-line app, including all Windows terminal emulators, in a separate tab. It is preconfigured to run Command Prompt, PowerShell, WSL, SSH, and Azure Cloud Shell Connector. With a few tweaks, the program might work.
|
||||
|
||||
For other distro Users:
|
||||
For other (linux) distro Users:
|
||||
Installation and use is the same.
|
||||
|
||||
In case the user switches to a different shell after installation:
|
||||
Repeat installation (Run sh ~/.shellnotes/install.sh).
|
||||
Repeat installation (Run sh ~/.shellnotes/install.sh) OR do source ~/.shellnotes/.shellnotes.sh in your configuation.
|
||||
|
||||
Installation failed? Here's why:
|
||||
-Your shell is not supported by shellnotes
|
||||
-You didn't run the installation file in the right directory
|
||||
-Your version is outdated or its installation is not supported (see SECURITY.md)
|
||||
-Your version is outdated or installation is not supported (see SECURITY.md)
|
||||
-You already have shellnotes installed
|
||||
|
||||
|
||||
How to install (versions 2.5 and lower)
|
||||
-This installation is not supported. However, to install, place shellnotes.sh and help into his Home folder. Then, add a dot behind the names of the main file (.shellnotes.sh). This will hide them from your folder. After that, open the terminal and type "chmod +x ~/.shellnotes.sh". This will give permissions to run the program. Finally, open your shell configuration file (ex. bashrc, zshrc) and put this line in the end of the file: "source ~/.shellnotes.sh".
|
|
@ -5,6 +5,6 @@ The listnotes command was introduced in shellnotes 1.2x and uses the command ls
|
|||
With listnotes, you can use parameters as well. For example:
|
||||
-listnotes -d or --dynamic for a dynamic view of all your notes and their content
|
||||
-listnotes -n or --number to see how many notes you have.
|
||||
Do 'man listnotes' for all options.
|
||||
|
||||
If listnotes doesn't show your note, try 'findmisplacednote' to track it.
|
||||
If listnotes doesn't recognize your notes folder, try running the shellnotes configuration tool (shellnotes -sd)
|
99
docs/manpages/clipnote.1
Normal file
99
docs/manpages/clipnote.1
Normal file
|
@ -0,0 +1,99 @@
|
|||
.\" Manpage for shellnotes-clipnote.
|
||||
.\" Contact dmarakom@gmail.com to correct errors or typos.
|
||||
|
||||
.TH clipnote 1
|
||||
.SH NAME
|
||||
|
||||
shellnotes-clipnote \- manipulate clipboard and notes
|
||||
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
.B clipnote
|
||||
[\fIOPTION\fR]
|
||||
[\fINOTENAME\fR]
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
.B clipnote
|
||||
manipulates clipboard and notes.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.TP
|
||||
.BR \-r ", " \--reverse
|
||||
Copy the content of a note into the clipboard.
|
||||
|
||||
.SH ARGUMENTS
|
||||
|
||||
.TP
|
||||
.BR \fINOTENAME\fR
|
||||
Name of the note to create or copy from.
|
||||
|
||||
.SH USAGE
|
||||
|
||||
Create a new note from the clipboard content:
|
||||
.PP
|
||||
.B clipnote
|
||||
[\fINOTENAME\fR]
|
||||
|
||||
Copy the content of a note into the clipboard:
|
||||
.PP
|
||||
.B clipnote
|
||||
\fB\-r\fR
|
||||
\fINOTENAME\fR
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
Dimitris Marakomihelakis (dmarakom@gmail.com)
|
||||
|
||||
.SH NOTES
|
||||
|
||||
This command requires the 'xclip' utility to be installed.
|
||||
|
||||
.SH COPYRIGHT
|
||||
|
||||
(C) Dimitris Marakomihelakis
|
||||
|
||||
Released under the "All rights reserved" category. See the RIGHTS.txt file
|
||||
in /docs/github/ for its full text.
|
||||
|
||||
.SH BUGS
|
||||
|
||||
None known.
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
.BR xclip (1)
|
||||
|
||||
.SH EXAMPLES
|
||||
|
||||
Create a new note named "example" from clipboard content:
|
||||
.PP
|
||||
.B clipnote
|
||||
example
|
||||
|
||||
Copy the content of the note "my_note" into the clipboard:
|
||||
.PP
|
||||
.B clipnote
|
||||
\fB\-r\fR
|
||||
my_note
|
||||
|
||||
.SH FILES
|
||||
|
||||
Notes are stored in the default notes folder.
|
||||
|
||||
.SH ENVIRONMENT
|
||||
|
||||
Default notes folder can be set using the \fBDEFAULT_PATH\fR environment variable.
|
||||
|
||||
.SH HISTORY
|
||||
|
||||
The \fBclipnote\fR command was introduced in version 4.0 of the shellnotes utility.
|
||||
|
||||
.SH BUG REPORTS
|
||||
|
||||
Please report bugs to dmarakom@gmail.com.
|
||||
|
||||
.SH COPYRIGHT
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
@ -31,13 +31,14 @@ Count the number of notes in your notes folder.
|
|||
.BR \-f ", " \--folder
|
||||
Show the current default notes folder.
|
||||
|
||||
.TP
|
||||
.BR \-v ", " \--view
|
||||
View notes one by one using the 'less' command. Press 'Q' to move from one note to the other and scroll with your mouse or arrow keys.
|
||||
|
||||
.SH BUGS
|
||||
|
||||
.TP
|
||||
.BR \-DynamicOutputBug ", " \-dOutBug ", " \116
|
||||
.PP
|
||||
listnotes -d output generates autoscroll, instead of starting from where the command was executed.
|
||||
|
||||
None known (as of Aug 13, 2023)
|
||||
.SH AUTHOR
|
||||
|
||||
Dimitris Marakomihelakis (dmarakom@gmail.com)
|
||||
|
|
|
@ -17,9 +17,6 @@ shellnotes-quicknote \- write a new note directly via terminal.
|
|||
uses your in-terminal text-editor to write a new note and saves it into your notes folder when finished.
|
||||
It works well with the nano editor.
|
||||
|
||||
.\".SH OPTIONS
|
||||
|
||||
.\".SH BUGS
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
|
|
70
docs/manpages/rmdups.1
Normal file
70
docs/manpages/rmdups.1
Normal file
|
@ -0,0 +1,70 @@
|
|||
.\" Manpage for shellnotes-rmdups.sh.
|
||||
.\" Contact dmarakom@gmail.com to correct errors or typos.
|
||||
|
||||
.TH rmdups 1
|
||||
.SH NAME
|
||||
|
||||
shellnotes-rmdups.sh \- remove duplicate lines from a note
|
||||
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
.B rmdups
|
||||
[\fIOPTION\fR]
|
||||
[\fINOTENAME\fR]
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
.B rmdups
|
||||
removes duplicate lines from a note.
|
||||
|
||||
.SH ARGUMENTS
|
||||
|
||||
.TP
|
||||
.BR \fINOTENAME\fR
|
||||
Name of the note to remove duplicate lines from.
|
||||
|
||||
.SH USAGE
|
||||
|
||||
Remove duplicate lines from a note:
|
||||
.PP
|
||||
.B rmdups
|
||||
[\fINOTENAME\fR]
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
Dimitris Marakomihelakis (dmarakom@gmail.com)
|
||||
|
||||
.SH NOTES
|
||||
|
||||
None.
|
||||
|
||||
.SH BUGS
|
||||
|
||||
None known.
|
||||
|
||||
.SH EXAMPLES
|
||||
|
||||
Remove duplicate lines from a note named "my_note":
|
||||
.PP
|
||||
.B rmdups
|
||||
my_note
|
||||
|
||||
.SH FILES
|
||||
|
||||
Notes are stored in the default notes folder.
|
||||
|
||||
.SH ENVIRONMENT
|
||||
|
||||
Default notes folder can be set using the \fBDEFAULT_PATH\fR environment variable.
|
||||
|
||||
.SH HISTORY
|
||||
|
||||
The \fBrmdups\fR command was introduced in version 4.0 of the shellnotes utility.
|
||||
|
||||
.SH BUG REPORTS
|
||||
|
||||
Please report bugs to dmarakom@gmail.com.
|
||||
|
||||
.SH COPYRIGHT
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
@ -49,6 +49,11 @@ Shellnotes auto-update searches for a new a new update in the project's github r
|
|||
.BR \-sd ", " \--set-defaults
|
||||
Redirects the user to the shellnotes configuration tool (set_defaults.sh)
|
||||
|
||||
.TP
|
||||
.BR \-ght ", " \--set-github-token
|
||||
Sets default github token for uploading notes to Github Gists via the Shellnotes Note Editor (SnE).
|
||||
|
||||
|
||||
.TP
|
||||
.BR \-l ", " \--logs
|
||||
View a logfile.
|
||||
|
|
152
docs/run.txt
152
docs/run.txt
|
@ -1,158 +1,6 @@
|
|||
How to run the files
|
||||
====================
|
||||
|
||||
The only files the user must run are located in the main branch of the source code tree: .shellnotes/
|
||||
|
||||
The tree looks like this:
|
||||
|
||||
|-- bash_update.sh
|
||||
|-- def
|
||||
| `-- defaults.sh
|
||||
|-- docs
|
||||
| |-- auths
|
||||
| | |-- author.txt
|
||||
| | `-- contributors.txt
|
||||
| |-- auto-update.txt
|
||||
| |-- commands.txt
|
||||
| |-- disabling.txt
|
||||
| |-- github
|
||||
| | |-- README.md
|
||||
| | |-- RIGHTS.txt
|
||||
| | `-- SECURITY.md
|
||||
| |-- help
|
||||
| |-- installing.txt
|
||||
| |-- listnotes.txt
|
||||
| |-- manpages
|
||||
| | |-- delnote.1
|
||||
| | |-- findmisplacednote.1
|
||||
| | |-- findnote.1
|
||||
| | |-- listnotes.1
|
||||
| | |-- newnote.1
|
||||
| | |-- noteinfo.1
|
||||
| | |-- quicknote.1
|
||||
| | |-- quickread.1
|
||||
| | |-- readnote.1
|
||||
| | |-- renamenote.1
|
||||
| | `-- shellnotes.1
|
||||
| |-- run.txt
|
||||
| |-- setdefaults.txt
|
||||
| |-- system
|
||||
| | |-- errors.txt
|
||||
| | |-- fileorganization.txt
|
||||
| | |-- hidden.txt
|
||||
| | |-- imports.txt
|
||||
| | |-- loggingsystem.txt
|
||||
| | |-- manpages.txt
|
||||
| | |-- requirements.txt
|
||||
| | |-- reset.txt
|
||||
| | `-- syntax.txt
|
||||
| |-- uninstalling.txt
|
||||
| |-- updating.txt
|
||||
| |-- versions.txt
|
||||
| `-- warnings.txt
|
||||
|-- image
|
||||
| `-- shellnotes.jpg
|
||||
|-- install.sh
|
||||
|-- logs
|
||||
| |-- disfailed.txt
|
||||
| |-- enfailed.txt
|
||||
| |-- ifailed.txt
|
||||
| |-- sdfailed.txt
|
||||
| |-- ufailed.txt
|
||||
| `-- uninfailed.txt
|
||||
|-- set_defaults.sh
|
||||
|-- uninstall.sh
|
||||
|-- update.sh
|
||||
|-- util
|
||||
| |-- ChMkDir.sh
|
||||
| |-- ChUpd.sh
|
||||
| |-- au
|
||||
| | `-- au.sh
|
||||
| |-- delnote.sh
|
||||
| |-- exec
|
||||
| | |-- clearlogs
|
||||
| | |-- disfailed
|
||||
| | |-- enfailed
|
||||
| | |-- ifailed
|
||||
| | |-- sdfailed
|
||||
| | |-- ufailed
|
||||
| | |-- uninfailed
|
||||
| |-- logfiles
|
||||
| | |-- disfailed.cpp
|
||||
| | |-- enfailed.cpp
|
||||
| | |-- ifailed.cpp
|
||||
| | |-- sdfailed.cpp
|
||||
| | |-- ufailed.cpp
|
||||
| | `-- uninfailed.cpp
|
||||
| |-- findmisplacednote.sh
|
||||
| |-- findnote.sh
|
||||
| |-- getv.sh
|
||||
| |-- h
|
||||
| | `-- h.sh
|
||||
| |-- l
|
||||
| | `-- l.sh
|
||||
| |-- listnotes
|
||||
| | |-- d
|
||||
| | | |-- d.py
|
||||
| | | |-- d.sh
|
||||
| | | |-- display.py
|
||||
| | | `-- dmain.py
|
||||
| | |-- f
|
||||
| | | `-- f.sh
|
||||
| | |-- n
|
||||
| | | `-- n.sh
|
||||
| | `-- output
|
||||
| | |-- dir.txt
|
||||
| | |-- direrr.txt
|
||||
| | |-- files.txt
|
||||
| | |-- fileserr.txt
|
||||
| | `-- listnotes.txt
|
||||
| |-- listnotes.sh
|
||||
| |-- newnote.sh
|
||||
| |-- noteinfo.sh
|
||||
| |-- quicknote.sh
|
||||
| |-- quickread.sh
|
||||
| |-- r
|
||||
| | `-- r.sh
|
||||
| |-- readnote.sh
|
||||
| |-- renamenote.sh
|
||||
| |-- sd
|
||||
| | |-- sd-input1.txt
|
||||
| | |-- sd-input2.txt
|
||||
| | |-- sd-input3.txt
|
||||
| | `-- sd.sh
|
||||
| |-- shellnotes.sh
|
||||
| |-- u
|
||||
| | `-- u.sh
|
||||
| `-- v
|
||||
| `-- v.sh
|
||||
`-- ver
|
||||
|
||||
|
||||
Or, in a ls -al representation:
|
||||
|
||||
drwxrwxr-x 8 dimitris dimitris 4096 Apr 18 13:00 .
|
||||
drwxr-xr-x 42 dimitris dimitris 4096 Apr 18 21:51 ..
|
||||
-rw-r--r-- 1 dimitris dimitris 1056 Apr 10 12:10 .shellnotes.sh
|
||||
-rw-r--r-- 1 dimitris dimitris 4580 Apr 18 12:45 bash_update.sh
|
||||
drwxr-xr-x 2 dimitris dimitris 4096 Apr 3 11:55 def
|
||||
drwxr-xr-x 6 dimitris dimitris 4096 Apr 3 11:55 docs
|
||||
drwxr-xr-x 2 dimitris dimitris 4096 Apr 3 11:55 image
|
||||
-rw-r--r-- 1 dimitris dimitris 3682 Apr 18 13:11 install.sh
|
||||
drwxr-xr-x 2 dimitris dimitris 4096 Apr 18 13:01 logs
|
||||
-rw-r--r-- 1 dimitris dimitris 2499 Apr 18 12:47 set_defaults.sh
|
||||
-rw-r--r-- 1 dimitris dimitris 3563 Apr 18 12:46 uninstall.sh
|
||||
-rw-r--r-- 1 dimitris dimitris 1646 Apr 18 12:45 update.sh
|
||||
drwxr-xr-x 14 dimitris dimitris 4096 Apr 18 12:06 util
|
||||
drwxr-xr-x 2 dimitris dimitris 4096 Apr 3 11:56 ver
|
||||
|
||||
|
||||
And in a dir style:
|
||||
|
||||
bash_update.sh docs install.sh set_defaults.sh update.sh ver
|
||||
def image logs uninstall.sh util
|
||||
|
||||
|
||||
Files inside .shellnotes/ are the ones you can run.
|
||||
The files inside the subfolders (util, def, logs, ver) must not be run.
|
||||
After the installation, the folder .shellnotes is created in the home (~) folder.
|
||||
|
|
|
@ -4,32 +4,32 @@ how to set defaults
|
|||
In shellnotes v.3.0 and later, there is a more dynamic and safe way of setting your default notes editors and folder.
|
||||
|
||||
|
||||
Changing both default note editors and Note folder with the sd system:
|
||||
-For <3.0 users, the command "shellnotes -sd" or "shellnotes --set-defaults" will redirect the user to set_defaults.sh, where he will be able to configure the default editors and folder safer, faster and more dynamically.
|
||||
Changing both default note editors and Note folder with the -sd parameter:
|
||||
-For <3.0 users, the command "shellnotes -sd" or "shellnotes --set-defaults" will run ~/.shellnotes/set_defaults.sh, where the user will be able to configure the default editors and folder.
|
||||
|
||||
Step by step instructions to change defaults with sd:
|
||||
1. After installing shellnotes, run "shellnotes --set-defaults" in your terminal.
|
||||
2. You will be redirected to ~/.shellnotes/set_defaults.sh, a runnable script. Select an option:
|
||||
2. Select an option:
|
||||
1. Change default regular notes editor:
|
||||
Regular notes are taken with newnote() and read with readnote().
|
||||
Select option 1 and enter the name of the program. It should be a valid name and not a path.
|
||||
Select option 1 and enter the name of the program. It should be a valid name and not a path. (i.e. "subl")
|
||||
2. Change default quick notes editor:
|
||||
Regular notes are taken with quicknote() and read with quickread().
|
||||
Select option 2 and enter the name of the program. It should be a valid name and not a path.
|
||||
Select option 2 and enter the name of the program. It should be a valid name and not a path. (i.e. "nano")
|
||||
3. Change default notes folder:
|
||||
All shellnotes' commands use the $DEFAULT_PATH variable to save, read, delete, rename notes.
|
||||
This means that the Notes folder to store your notes must be a valid path.
|
||||
The default notes folder as you may know is ~/Notes and is created at first terminal launch with shellnotes installed.
|
||||
The default notes folder is ~/Notes and is created at first terminal launch with shellnotes installed.
|
||||
Select option 3 and enter the full path of the directory. It should be a valid absolute path and not a relative one.
|
||||
4. View defaults:
|
||||
sd gives the user the option to also view current defaults.
|
||||
-sd gives the user the option to also view current defaults.
|
||||
Select option 4 and take a look at your defaults.
|
||||
3. When you're done, restart your terminal and the defaults will have been changed.
|
||||
WARNING: If a name or a path is not valid in step 2, you will be reminded by the script and the
|
||||
3. When you're done, restart your terminal and the defaults will change.
|
||||
WARNING: If a name or a path is not valid in step 2, the
|
||||
setting will fail.
|
||||
|
||||
|
||||
For 3.0 and earlier users: (text from help page)
|
||||
For 3.0 and earlier:
|
||||
|
||||
|
||||
Changing default editors manually:
|
||||
|
@ -41,14 +41,14 @@ Changing default editors manually:
|
|||
problems may occur.
|
||||
|
||||
Default editors:
|
||||
for newnote: gedit (ubuntu default)
|
||||
for newnote: SnE (Shellnotes Notes Editor, installed by default)
|
||||
for quicknote: nano (in-terminal experience)
|
||||
Suggested editors other than default:
|
||||
for newnote: Sublime text, Atom
|
||||
for newnote: Sublime text, Atom, gedit
|
||||
for quicknote: Vim
|
||||
|
||||
Changing default Notes Folder manually:
|
||||
Changing default folder manually is a feature enabled in shellnotes <2.5. In case the user wants to change the default folder to store/write/list/rename/read/delete his notes, he must change the DEFAULT_PATH value from defaults.sh in ~/.shellnotes/def/. This is a variable that the rest of the code uses to check the default folder for all the commands to make change in the right directory. This means that if you change the name of the path the variable is going to search for, the code will use your prefered folder. In case the path is incorrect, problems may occur.
|
||||
Changing default folder manually is a possible in shellnotes <2.5. In case the user wants to change the default folder to store/write/list/rename/read/delete his notes, he must change the DEFAULT_PATH value from defaults.sh in ~/.shellnotes/def/. This is a variable that the rest of the code uses to check the default folder for all the commands to make change in the right directory. This means that if you change the name of the path the variable is going to search for, the code will use your prefered folder. In case the path is incorrect, problems may occur.
|
||||
|
||||
Default path:
|
||||
Home/Notes/
|
||||
|
|
141
docs/sne.md
Normal file
141
docs/sne.md
Normal file
|
@ -0,0 +1,141 @@
|
|||
# SnE - Shellnotes Notes Editor Documentation
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Introduction](#introduction)
|
||||
2. [Features](#features)
|
||||
3. [Integration with Shellnotes](#integration-with-shellnotes)
|
||||
4. [Usage](#usage)
|
||||
5. [Logging System](#logging-system)
|
||||
6. [Tools](#tools)
|
||||
7. [Pasting Notes](#pasting-notes)
|
||||
8. [Conclusion](#conclusion)
|
||||
|
||||
## Introduction <a name="introduction"></a>
|
||||
|
||||
SnE (Shellnotes Notes Editor) is a text editor developed as part of the Shellnotes Project. Shellnotes is a terminal-based note-taking tool for Linux users. SnE provides users with a graphical interface to create, edit, and manage their notes efficiently via a user-friendly text editor. SnE is built using the Tkinter library and offers various features to enhance the note-taking experience.
|
||||
|
||||
## Features <a name="features"></a>
|
||||
|
||||
SnE comes equipped with several features to facilitate note-taking and editing:
|
||||
|
||||
- **Graphical User Interface:** SnE offers a graphical interface for creating and editing notes, making it user-friendly and accessible.
|
||||
|
||||
- **Text Editing:** Users can input and edit text using standard text editing functionalities such as copy, paste, undo, redo, and find.
|
||||
|
||||
- **Styling Options:** SnE allows users to customize the font family, font size, and font weight of their notes for better readability and personalization.
|
||||
|
||||
- **Themes:** Users can choose from a selection of themes to customize the appearance of the editor to their liking.
|
||||
|
||||
- **Character Count:** SnE displays a live character count at the bottom of the editor to help users keep track of their note length.
|
||||
|
||||
- **Spell Check:** The editor includes a spell check feature that highlights misspelled words and suggests corrections.
|
||||
|
||||
- **Text-to-Speech:** SnE can read selected text or the entire note aloud using a text-to-speech engine.
|
||||
|
||||
- **Integration:** SnE seamlessly integrates with Shellnotes, allowing users to create and manage notes directly from their terminal, using the `newnote` command.
|
||||
|
||||
## Integration with Shellnotes <a name="integration-with-shellnotes"></a>
|
||||
|
||||
Users can launch SnE from the terminal using the command `newnote`, but they can also use it as a regular text editor by typing `NOTES_EDITOR` into the terminal.
|
||||
|
||||
## Usage <a name="usage"></a>
|
||||
|
||||
To launch SnE and start creating/editing notes, follow these steps:
|
||||
|
||||
1. Open your terminal.
|
||||
|
||||
2. Navigate to the directory where you have Shellnotes installed.
|
||||
|
||||
3. Use the appropriate command to launch SnE:
|
||||
`newnote`
|
||||
|
||||
|
||||
4. The SnE window will appear, providing a text editor interface.
|
||||
|
||||
5. Use the available features (copy, paste, save, etc.) to create and edit your notes.
|
||||
|
||||
6. Customize the editor's font style, size, weight, and theme according to your preferences.
|
||||
|
||||
7. When you're done editing, save your note and close SnE.
|
||||
|
||||
## Logging System <a name="logging-system"></a>
|
||||
|
||||
SnE incorporates a logging system to track events and errors. The log files are stored in the user's home directory under `~/.shellnotes/logs/sne`. The logging system helps diagnose issues, monitor usage, and improve the overall stability of the application. This is achieved by the help of the python-loguru library.
|
||||
|
||||
## Tools <a name="tools"></a>
|
||||
|
||||
### Text-to-Speech (Read Aloud)
|
||||
|
||||
SnE provides a convenient Text-to-Speech (TTS) feature that allows you to have your notes read aloud. This feature is especially useful for proofreading, reviewing content, or simply listening to your notes. SnE uses the `pyttsx3` library to enable the TTS functionality.
|
||||
|
||||
**Usage:**
|
||||
|
||||
1. Select the text you want to hear read aloud within the editor.
|
||||
2. Click on the "Tools" menu.
|
||||
3. Choose the "Read Aloud" option.
|
||||
4. The selected text will be converted into speech and played through your system's audio output.
|
||||
|
||||
### Search & Replace (Using `notegrep`)
|
||||
|
||||
SnE incorporates a powerful search and replace functionality using the `notegrep` tool. This tool allows you to search for specific patterns within your notes and replace them with new content. `notegrep` leverages regular expressions to perform advanced searches and replacements.
|
||||
|
||||
**Usage:**
|
||||
|
||||
1. Click on the "Tools" menu.
|
||||
2. Select "Find" to search for specific text within the note. You can enter a keyword or phrase to search for.
|
||||
3. Choose "Replace All..." to initiate a search and replace operation. This option lets you replace all occurrences of a particular text with a new value.
|
||||
4. A separate window will appear, allowing you to specify the search pattern and the replacement text using regular expressions.
|
||||
5. Once you've configured the search and replacement, click the "Replace" button to perform the operation.
|
||||
|
||||
### Spell Check
|
||||
|
||||
SnE includes a built-in spell check tool that helps you identify and correct spelling errors in your notes. It uses the `enchant` library to check the spelling of words against a dictionary. Misspelled words are highlighted, so that corrections can be made easily.
|
||||
|
||||
**Usage:**
|
||||
|
||||
1. Click on the "Tools" menu.
|
||||
2. Choose the "Spell Check" option.
|
||||
3. The spell check tool will scan the entire note for spelling errors.
|
||||
4. Any misspelled words will be highlighted, usually with a red background.
|
||||
5. To correct a misspelled word, right-click on it, and you'll be presented with suggested corrections. Select the appropriate correction to update the word.
|
||||
6. Once the spell check is complete, your note will be free of spelling errors.
|
||||
|
||||
These additional tools enhance the usability and functionality of SnE by offering capabilities such as text-to-speech conversion, advanced search and replace using regular expressions, and an integrated spell check feature. These tools contribute to an improved note-taking experience, ensuring accurate and high-quality content creation.
|
||||
|
||||
|
||||
## Pasting Notes <a name="pasting-notes"></a>
|
||||
|
||||
SnE offers the ability to paste your notes to external services for sharing or backup purposes. It provides integration with both Pastebin and GitHub Gists.
|
||||
|
||||
### Pasting on Pastebin
|
||||
To paste your note on Pastebin:
|
||||
|
||||
1. Click on the "Tools" menu.
|
||||
|
||||
2. Select "Paste on Pastebin."
|
||||
|
||||
3. A link to the Pastebin page containing your note will be displayed.
|
||||
|
||||
4. Optionally, click the "Copy" button to copy the link to your clipboard.
|
||||
|
||||
### Pasting on GitHub Gists
|
||||
To paste your note on GitHub Gists:
|
||||
|
||||
1. Click on the "Tools" menu.
|
||||
|
||||
2. Select "Paste on Github Gists."
|
||||
|
||||
3. If prompted, ensure that your GitHub token (GH_TOKEN) is set using the `shellnotes --set-github-token` command.
|
||||
|
||||
4. A link to the GitHub Gist containing your note will be displayed.
|
||||
|
||||
5. Optionally, click the "Copy" button to copy the link to your clipboard.
|
||||
|
||||
> By default, uploaded notes are private, but you can make them public on demand.
|
||||
|
||||
## Conclusion <a name="conclusion"></a>
|
||||
|
||||
SnE (Shellnotes Notes Editor) enhances the Shellnotes experience by providing a feature-rich graphical interface for creating, editing, and managing notes. With its user-friendly design and integration with Shellnotes, SnE offers a seamless note-taking solution for Linux users. Its versatile features, logging system, and options to paste notes to external services make it a powerful tool for efficient note management.
|
||||
|
||||
For any issues, inquiries, or suggestions, please refer to the official Shellnotes documentation or reach out to the developer Dimitris Marakomichelakis.
|
|
@ -3,4 +3,5 @@ errors
|
|||
|
||||
Some errors are logged into .shellnotes/logs/ which you can check with "shellnotes -l".
|
||||
These are usually errors that occur during processes, like installing, uninstalling, updating,
|
||||
enabling or disabling, failing to set defaults etc.
|
||||
enabling or disabling, failing to set defaults etc.
|
||||
You can also (4.0+) display the logs of the Shellnotes Notes Editor using the same command.
|
|
@ -9,9 +9,10 @@ Files the user can run manually are located in ~/.shellnotes/ after the installa
|
|||
-.shellnotes.sh -> Running shellnotes (main file)
|
||||
|
||||
Other folders and their content:
|
||||
-util: all the commands used in ~/.shellnotes/.shellnotes.sh, as well as all its subfolders.
|
||||
-util: all the commands used in ~/.shellnotes/.shellnotes.sh (subfolders are their parameters).
|
||||
-def: default note editors and folders used in configuration tool.
|
||||
-logs: Logfiles for failed updates, installations etc.
|
||||
-ver: Current shellnotes version
|
||||
-ver: Current shellnotes version, used when updating.
|
||||
-sne: The source code, environment and logs for the Shellnotes Note Editor.
|
||||
-docs: Documentation
|
||||
-image: .jpg and .png files used for README
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
hidden commands
|
||||
===============
|
||||
|
||||
Most shellnotes' commands are known, and shown in commands.txt, but some scripts contain hidden
|
||||
commands as well. These scripts are hidden files and can be found in .shellnotes/util/.hidden/.
|
||||
Shellnotes have hidden commands as well. Their scripts are hidden files and can be found in .shellnotes/util/.hidden/.
|
||||
|
||||
They are hidden mainly because shellnotes does not want the user to use them on a daily basis. This
|
||||
is because they stop or start extra processes, clear logfiles, or change valuable information and
|
||||
data in the source path. The user can always refer to these commands, but only when necessary.
|
||||
They are hidden mainly because shellnotes does not want the user to use them on a daily basis. They change valuable information like configuration and logs. The user can always refer to these commands, but only when necessary.
|
||||
Otherwise, it is not recommended to use them.
|
|
@ -2,30 +2,26 @@ shellnotes imports rule
|
|||
=======================
|
||||
|
||||
The main script for running shellnotes is .shellnotes.sh found in ~/.shellnotes/.shellnotes.sh after
|
||||
the installation. This file contains the user's default shell, found during the installation
|
||||
proccess, as well as all the imports needed for the program to work. The imports consist of:
|
||||
the installation. This file contains the user's default shell's shebang, found during the installation
|
||||
proccess, as well as all the imports needed for the program to work. These are:
|
||||
|
||||
1. Commands (most of the files found in /util)
|
||||
2. Scripts run every time the terminal is launched (i.e. Version getter (getv))
|
||||
3. The shellnotes command with all of its parameters (file found in /util/shellnotes.sh, params
|
||||
in subfolders of util/)
|
||||
4. "Hidden" commands (files containing a (.) in /util, actions for cleaning space etc.)
|
||||
2. Scripts run every time the terminal is launched (i.e. Version retriever (getv))
|
||||
3. "Hidden" commands (files containing a (.) in /util, actions for clearing space etc.)
|
||||
|
||||
In the .shellnotes.sh file, the imports are ordered like this:
|
||||
|
||||
#user's shell
|
||||
#!user's shell
|
||||
|
||||
#Warnings
|
||||
#Warnings
|
||||
|
||||
|
||||
scripts run every time the terminal is launched
|
||||
->scripts run every time the terminal is launched
|
||||
|
||||
utility scripts (commands) found in ~/.shellnotes/util/
|
||||
->utility scripts (commands) found in ~/.shellnotes/util/
|
||||
|
||||
|
||||
. ~/.shellnotes/util/shellnotes.sh -> The shellnotes command, which imports all its parameters
|
||||
-> . ~/.shellnotes/util/shellnotes.sh -> The shellnotes command
|
||||
|
||||
|
||||
Hidden commands (i.e. clearlogs, run only when necessary)
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
shellnotes logging system
|
||||
=========================
|
||||
|
||||
The shellnotes logging system consists of .cpp (C++) files, that are compiled and run
|
||||
if an error occurs when updating, installing or setting default editors and folders for your notes.
|
||||
The shellnotes logging system consists of .cpp (C++) files, that are precompiled and run
|
||||
if an error occurs while using shellnotes.
|
||||
|
||||
Errors that might occur:
|
||||
update.sh / bash_update.sh:
|
||||
|
@ -27,10 +27,16 @@ Errors that might occur:
|
|||
uninstall.sh (enabling option 3):
|
||||
-Shellnotes is already enabled
|
||||
-Shellnotes is uninstalled
|
||||
SnE (Shellnotes Notes Editor):
|
||||
-Note name is invalid (i.e. "")
|
||||
-Github Token is not set (when pasting to Gists, do shellnotes -ght)
|
||||
-Failed to save a new note
|
||||
|
||||
If any of the above errors occur in runtime, the matching .cpp file found in ~/.shellnotes/util/failed/
|
||||
write a report of the error containing the type of error and the date in the matching logfiles found in ~/.shellnotes/logs/.
|
||||
|
||||
For SnE, since it is a python script, the loguru module is being used everytime an error occurs and is saved to ~/.shellnotes/sne/logs/.
|
||||
|
||||
Opening the logfiles:
|
||||
-Do NOT open the files manually using any text editor. Use "shellnotes --logs" to select a logfile and check it.
|
||||
|
||||
|
@ -40,6 +46,7 @@ Opening the logfiles:
|
|||
~/.shellnotes/logs/ifailed.txt - failed attempt to install shellnotes.
|
||||
~/.shellnotes/logs/uninfailed.txt - failed attempt to uninstall shellnotes.
|
||||
~/.shellnotes/logs/ufailed.txt - failed attempt to update shellnotes.
|
||||
~/.shellnotes/sne/logs/ - errors/info while running SnE.
|
||||
|
||||
To close a file after you chose to open it, press "Q". Shellnotes uses the less command to view
|
||||
its logfiles.
|
||||
|
|
|
@ -10,11 +10,12 @@ Software requirements:
|
|||
-curl
|
||||
-git
|
||||
-Python 3.5 or later
|
||||
-GNU g++ compiler for c++ v.9.3.0 or later
|
||||
-Solid Internet Connection required for updating (at least 5mbps)
|
||||
|
||||
*Note* All unmet software dependencies will be installed alongside shellnotes.
|
||||
|
||||
Hardware requirements (Minimum):
|
||||
-Processor : Intel® Core™ i3-L13G4
|
||||
-RAM : 700 MB
|
||||
-HDD/SSD : 500 MB free space
|
||||
-HDD/SSD : 400 MB free space
|
||||
|
|
@ -2,16 +2,14 @@ About Uninstalling
|
|||
==================
|
||||
|
||||
How to uninstall (versions 2.5 and lower)
|
||||
-Deleting shellnotes >2.5 is done manually (just like installing). Delete the hidden(.) files from your Home folder, then delete or comment-out the line where the source to the file is used from your shell configuration file.
|
||||
-Deleting shellnotes <2.5 is done manually (just like installing). Delete the hidden(.) files from your Home folder, then delete or comment-out the line where the source to the file is used from your shell configuration file.
|
||||
|
||||
How to uninstall (version 3.0 and higher)
|
||||
-Deleting shellnotes <3.0 is done automatically (just like installing). Run the file uninstall.sh by typing "sh ~/.shellnotes/uninstall.sh" and select the first option. Then restart your terminal.
|
||||
-Deleting shellnotes >3.0 is done automatically (just like installing). Run the file uninstall.sh by typing "sh ~/.shellnotes/uninstall.sh" and select the first option. Then restart your terminal.
|
||||
|
||||
About uninstalling:
|
||||
-Your notes will stay in your notes folder even if you choose to delete shellnotes.
|
||||
-If you get an error every time you launch the terminal, more than one source for the scripts
|
||||
have been sent to your shell configuration file. To stop the error messages, open the
|
||||
configuration file and delete 'source ~/.shellnotes/.shellnotes.sh', usually found in the last
|
||||
-If you get an error every time you launch the terminal, open your shell configuration
|
||||
(i.e. .zshrc) and remove 'source ~/.shellnotes/.shellnotes.sh', usually found in the last
|
||||
line of the file.
|
||||
For other users:
|
||||
Uninstallation must be done manually by the user.
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ About Updating
|
|||
==============
|
||||
|
||||
How to update:
|
||||
For non-bash shell users, there is a file called update.sh in ~/.shellnotes/. The user can run this script by typing sh ~/.shellnotes/update.sh
|
||||
For bash users, there is a unique update file called bash_update.sh. Run it with:
|
||||
- For bash users, there is a unique update file called bash_update.sh. Run it with:
|
||||
bash ~/.shellnotes/bash_update.sh.
|
||||
Or just type "shellnotes --update" in your terminal and shellnotes will find your shell and
|
||||
- For other shell users, there is a file called update.sh in ~/.shellnotes/. The user can run this script by typing sh ~/.shellnotes/update.sh
|
||||
- Or just type "shellnotes --update" in your terminal and shellnotes will find your shell and
|
||||
redirect you to the correct update script.
|
||||
|
||||
About updating:
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
Some warnings: (text from help page)
|
||||
Some warnings
|
||||
|
||||
WARNING: Installing/Uninstalling/Disabling/Updating is NOT possible unless ALL the source code files are IN THE SAME DIRECTORY.
|
||||
WARNING: install.sh must be run from the folder where it was downloaded WITH the other files from the repo. Otherwise, installation will fail. uninstall.sh must be run from ~/.shellnotes/ because shellnotes is already installed. If you choose to run update.sh manually, it must be done from ~/.shellnotes as well. Type 'sh ~/.shellnotes/update.sh'. Otherwise, run 'shellnotes -u' or 'shellnotes --update' to run the script instantly.
|
||||
WARNING: Automatic Installation, uninstallation and update is a feature for shellnotes <2.5. Older versions require manual installation, uninstallation and update. Disabling is also a <2.5 feature.
|
||||
WARNING: The default shell for installing/uninstalling/updated is bash. However, shellnotes will find your shell if it's different and continue installing according to it. If your shell is not supported though, the installation/uninstallation/update will FAIL.
|
||||
WARNING: Automatic Installation, uninstallation and update is a feature for shellnotes >2.5. Older versions require manual installation, uninstallation and update. Disabling is also a >2.5 feature.
|
||||
WARNING: The default shell for this program is bash. However, shellnotes will identify your shell if it's different. If your shell is not supported though, the installation will FAIL.
|
18
install.sh
18
install.sh
|
@ -6,7 +6,7 @@ Released under the "All rights reserved" category. See the RIGHTS.txt file
|
|||
in /docs/github/ for its full text.
|
||||
info
|
||||
|
||||
VER_TO_INSTALL=3.5 #This is used when updating, it will be changed in every new update
|
||||
VER_TO_INSTALL=4.0 #This is used when updating, it will be changed in every new update
|
||||
if [ -e ~/.shellnotes/.shellnotes.sh ]; then
|
||||
echo "Shellnotes is already installed."
|
||||
echo "If you want to update, please run 'update.sh'."
|
||||
|
@ -20,6 +20,7 @@ else
|
|||
mv def ~/.shellnotes/
|
||||
mv logs ~/.shellnotes/
|
||||
mv ver ~/.shellnotes/
|
||||
mv sne ~/.shellnotes/
|
||||
mv image ~/.shellnotes/
|
||||
mv shellnotes.sh ~/.shellnotes/.shellnotes.sh
|
||||
mv $0 ~/.shellnotes/
|
||||
|
@ -38,15 +39,26 @@ else
|
|||
sudo cp ~/.shellnotes/docs/manpages/* /usr/local/man/man1/
|
||||
sudo gzip -f /usr/local/man/man1/*.1
|
||||
sudo mandb >/dev/null
|
||||
sudo apt-get install xclip
|
||||
|
||||
sudo apt install python3
|
||||
sudo apt install python3-pip
|
||||
sudo apt install python3 -y
|
||||
sudo apt install python3-pip -y
|
||||
pip install pathlib
|
||||
|
||||
sudo apt update
|
||||
sudo chmod a+x ~/.shellnotes/util/exec/*
|
||||
sudo chmod +x ~/.shellnotes/.shellnotes.sh
|
||||
|
||||
clear
|
||||
echo "Installing Shellnotes Note Editor (SnE)..."
|
||||
|
||||
echo "DEFAULT_PATH=$HOME" > ~/.shellnotes/sne/.env
|
||||
#Install dependencies
|
||||
pip install -r ~/.shellnotes/sne/requirements.txt
|
||||
sudo apt-get install espeak -y
|
||||
|
||||
|
||||
|
||||
echo "$VER_TO_INSTALL" > ~/.shellnotes/ver/.shellnotes_version
|
||||
|
||||
if [ -n "`$SHELL -c 'echo $ZSH_VERSION'`" ]; then
|
||||
|
|
0
logs/sne/logfile_<module 'time' (built-in)>.log
Normal file
0
logs/sne/logfile_<module 'time' (built-in)>.log
Normal file
|
@ -71,6 +71,7 @@ elif [[ "$input" == "3" ]]; then
|
|||
else
|
||||
mv $DEFAULT_PATH/* $name
|
||||
echo "$name" > ~/.shellnotes/util/shellnotes/sd/sd-input3.txt
|
||||
echo "DEFAULT_PATH=$name" >> ~/.shellnotes/sne/.env
|
||||
echo "Default notes folder updated."
|
||||
echo "Please restart your terminal."
|
||||
fi
|
||||
|
|
8
shellnotes.sh
Normal file → Executable file
8
shellnotes.sh
Normal file → Executable file
|
@ -1,20 +1,20 @@
|
|||
|
||||
|
||||
|
||||
#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 (lines 10, 25, 40).
|
||||
|
||||
#The lines below must NOT be changed.
|
||||
export DIR="$(pwd)"
|
||||
export DIR=$(pwd)
|
||||
|
||||
. ~/.shellnotes/whatsnew.sh
|
||||
|
||||
. ~/.shellnotes/util/getv.sh
|
||||
. ~/.shellnotes/def/defaults.sh
|
||||
. ~/.shellnotes/util/ChMkDir.sh
|
||||
. ~/.shellnotes/util/readnote.sh
|
||||
. ~/.shellnotes/util/quickread.sh
|
||||
. ~/.shellnotes/util/quicknote.sh
|
||||
. ~/.shellnotes/util/newnote.sh
|
||||
. ~/.shellnotes/util/readnote.sh
|
||||
. ~/.shellnotes/util/delnote.sh
|
||||
. ~/.shellnotes/util/listnotes.sh
|
||||
. ~/.shellnotes/util/findnote.sh
|
||||
|
@ -22,6 +22,8 @@ export DIR="$(pwd)"
|
|||
. ~/.shellnotes/util/renamenote.sh
|
||||
. ~/.shellnotes/util/notewc.sh
|
||||
. ~/.shellnotes/util/notegrep.sh
|
||||
. ~/.shellnotes/util/clipnote.sh
|
||||
. ~/.shellnotes/util/rmdups.sh
|
||||
|
||||
|
||||
|
||||
|
|
0
sne/.env
Normal file
0
sne/.env
Normal file
29
sne/gist.py
Normal file
29
sne/gist.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import os
|
||||
import sys
|
||||
import json
|
||||
import datetime
|
||||
import requests
|
||||
|
||||
def create_gist_with_requests(headers, body):
|
||||
response = requests.post('https://api.github.com/gists', json=body, headers=headers)
|
||||
if response.ok:
|
||||
response_data = response.json()
|
||||
return response_data["html_url"]
|
||||
else:
|
||||
raise RuntimeError(f"Github API error: {response.status_code}")
|
||||
|
||||
def create_gist(text, token):
|
||||
today = datetime.date.today()
|
||||
headers = {
|
||||
'Authorization': f'Bearer {token}',
|
||||
'User-agent': 'python-gist',
|
||||
'Accept': 'application/json',
|
||||
'X-GitHub-Api-Version': '2022-11-28'
|
||||
}
|
||||
body = {
|
||||
"description": f"Uploaded on {today} via SnE",
|
||||
"files": {f"{today}.txt": {"content": text}},
|
||||
"public": False
|
||||
}
|
||||
|
||||
return create_gist_with_requests(headers, body)
|
14
sne/pastebin.py
Normal file
14
sne/pastebin.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
import requests
|
||||
|
||||
|
||||
def pastebin(text):
|
||||
api_key = "d2004f9b24624585334cc3950ab6a7e0"
|
||||
url = "https://pastebin.com/api/api_post.php"
|
||||
payload = {
|
||||
"api_dev_key": api_key,
|
||||
"api_paste_code": text,
|
||||
"api_paste_private": 0,
|
||||
"api_option": "paste"
|
||||
}
|
||||
res = requests.post(url, data=payload)
|
||||
return (res.text)
|
17
sne/requirements.txt
Normal file
17
sne/requirements.txt
Normal file
|
@ -0,0 +1,17 @@
|
|||
astroid==2.3.3
|
||||
isort==4.3.21
|
||||
lazy-object-proxy==1.4.3
|
||||
mccabe==0.6.1
|
||||
Pillow==9.3.0
|
||||
pycodestyle==2.5.0
|
||||
pyenchant==2.0.0
|
||||
Pygments==2.15.0
|
||||
pylint==2.4.4
|
||||
pyttsx3==2.71
|
||||
six==1.13.0
|
||||
ttkthemes==2.4.0
|
||||
typed-ast==1.4.0
|
||||
wrapt==1.11.2
|
||||
python-dotenv==1.0.0
|
||||
loguru==0.7.0
|
||||
|
612
sne/sne.py
Normal file
612
sne/sne.py
Normal file
|
@ -0,0 +1,612 @@
|
|||
"""
|
||||
SnE - Shellnotes Notes Editor
|
||||
Developed by Dimitris Marakomichelakis
|
||||
"""
|
||||
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from tkinter import *
|
||||
from functools import partial
|
||||
from tkinter import messagebox
|
||||
from tkinter import filedialog
|
||||
from tkinter import simpledialog
|
||||
import tkinter.font as tkFont
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import pyttsx3
|
||||
import enchant
|
||||
from ttkthemes import ThemedTk
|
||||
import pastebin
|
||||
from dotenv import load_dotenv
|
||||
from gist import create_gist
|
||||
from loguru import logger
|
||||
|
||||
load_dotenv() #.env must contain the GH_TOKEN variable, set via shellnotes --set-github-token
|
||||
default_path = os.environ.get("DEFAULT_PATH")
|
||||
|
||||
def _log(level, message):
|
||||
log_dir = os.path.expanduser("~/.shellnotes/logs/sne") # Use a valid path for the log directory
|
||||
os.makedirs(log_dir, exist_ok=True) # Create the directory if it doesn't exist
|
||||
log_path = os.path.join(log_dir, f"logfile_{time}.log")
|
||||
logger.add(log_path)
|
||||
# print(log_path)
|
||||
|
||||
if level == "TRACE":
|
||||
logger.trace(message)
|
||||
elif level == "DEBUG":
|
||||
logger.debug(message)
|
||||
elif level == "INFO":
|
||||
logger.info(message)
|
||||
elif level == "SUCCESS":
|
||||
logger.success(message)
|
||||
elif level == "WARNING":
|
||||
logger.warning(message)
|
||||
elif level == "ERROR":
|
||||
logger.error(message)
|
||||
elif level == "CRITICAL":
|
||||
logger.info(message)
|
||||
else:
|
||||
return "Failed to log"
|
||||
|
||||
|
||||
|
||||
class Container(Text):
|
||||
"""
|
||||
A TextWidget with horizontal and vertical scrollbars
|
||||
"""
|
||||
|
||||
def __init__(self, master=None, **kw):
|
||||
self.frame = ttk.Frame(master)
|
||||
self.vbar = ttk.Scrollbar(self.frame, command=self.yview)
|
||||
self.vbar.pack(side=RIGHT, fill=Y)
|
||||
self.hbar = ttk.Scrollbar(
|
||||
self.frame, orient="horizontal", command=self.xview)
|
||||
self.hbar.pack(side=BOTTOM, fill=X)
|
||||
kw.update({'yscrollcommand': self.vbar.set})
|
||||
kw.update({'xscrollcommand': self.hbar.set})
|
||||
Text.__init__(self, self.frame, **kw)
|
||||
self.pack(side=LEFT, fill=BOTH, expand=True)
|
||||
text_meths = vars(Text).keys()
|
||||
methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys()
|
||||
methods = methods.difference(text_meths)
|
||||
|
||||
for m in methods:
|
||||
if m[0] != '_' and m != 'config' and m != 'configure':
|
||||
setattr(self, m, getattr(self.frame, m))
|
||||
|
||||
def __str__(self):
|
||||
return str(self.frame)
|
||||
|
||||
|
||||
class Editor:
|
||||
"""
|
||||
Base Class of Editor
|
||||
"""
|
||||
window = ThemedTk()
|
||||
style = ttk.Style()
|
||||
window.title("SnE")
|
||||
# window.geometry(
|
||||
# "{0}x{1}+0+0".format(window.winfo_screenwidth(),
|
||||
# window.winfo_screenheight()))
|
||||
window.geometry("500x500")
|
||||
menuBar = Menu(window)
|
||||
#The text and entry frames column
|
||||
window.grid_columnconfigure(1, weight=1)
|
||||
window.grid_rowconfigure(0, weight=1)
|
||||
#Menu bar
|
||||
window.config(menu=menuBar)
|
||||
fileMenu = Menu(menuBar, tearoff=0)
|
||||
editMenu = Menu(menuBar, tearoff=0)
|
||||
viewMenu = Menu(menuBar, tearoff=0)
|
||||
toolMenu = Menu(menuBar, tearoff=0)
|
||||
helpMenu = Menu(menuBar, tearoff=0)
|
||||
txt = Container(window, undo=True)
|
||||
txt.grid(row=0, column=1, sticky="NSEW")
|
||||
lineNumber = Canvas(window, width="30", height="500")
|
||||
lineNumber.grid(row=0, column=0, sticky='NS', pady=1, rowspan=3)
|
||||
charCount = StringVar()
|
||||
charCount.set("Characters: 0")
|
||||
statusBar = ttk.Label(window, textvariable=charCount)
|
||||
statusBar.grid(row=2, column=1, columnspan=2, sticky="EW")
|
||||
txt['wrap'] = 'none'
|
||||
fontType = "Helvetica"
|
||||
fontSize = "15"
|
||||
fontColor = "black"
|
||||
fontWeight = "normal"
|
||||
txt.configure(font=(fontType, fontSize, fontWeight))
|
||||
currentFile = "No File"
|
||||
|
||||
def __init__(self):
|
||||
# Disable default bindings for Ctrl+C and Ctrl+V
|
||||
self.txt.unbind("<Control-c>")
|
||||
self.txt.unbind("<Control-v>")
|
||||
|
||||
self.fileMenu.add_command(
|
||||
label="New", command=self.new_file, accelerator="Ctrl+N")
|
||||
self.window.bind_all('<Control-n>', self.new_file)
|
||||
# self.fileMenu.add_command(
|
||||
# label="Open", command=self.open_file, accelerator="Ctrl+O")
|
||||
# self.window.bind_all('<Control-o>', self.open_file)
|
||||
self.fileMenu.add_command(
|
||||
label="Save", command=self.save_file, accelerator="Ctrl+S")
|
||||
self.window.bind_all('<Control-s>', self.save_file)
|
||||
self.fileMenu.add_command(
|
||||
label="Save As", command=self.save_file_as,
|
||||
accelerator="Ctrl+Shift+S")
|
||||
self.window.bind_all('<Control-S>', self.save_file_as)
|
||||
self.fileMenu.add_command(label="Exit", command=self.exit)
|
||||
self.menuBar.add_cascade(label="File", menu=self.fileMenu)
|
||||
self.editMenu = Menu(self.menuBar, tearoff=0)
|
||||
self.editMenu.add_command(label="Cut", command=self.cut)
|
||||
self.editMenu.add_command(
|
||||
label="Copy", command=self.copy, accelerator="Ctrl+C")
|
||||
self.window.bind_all('<Control-c>', self.copy)
|
||||
self.editMenu.add_command(
|
||||
label="Paste", command=self.paste, accelerator="Ctrl+V")
|
||||
self.window.bind_all('<Control-v>', self.paste)
|
||||
self.editMenu.add_command(
|
||||
label="Undo", command=self.undo, accelerator="Ctrl+Z")
|
||||
self.window.bind_all('<Control-z>', self.undo)
|
||||
self.editMenu.add_command(
|
||||
label="Redo", command=self.redo, accelerator="Ctrl+R")
|
||||
self.window.bind_all('<Control-r>', self.redo)
|
||||
|
||||
|
||||
self.toolMenu = Menu(self.menuBar, tearoff=0)
|
||||
self.toolMenu.add_command(
|
||||
label="Find", command=self.find, accelerator="Ctrl+F")
|
||||
self.window.bind_all('<Control-f>', self.find)
|
||||
self.toolMenu.add_command(
|
||||
label="Replace All...", command=self.replace,
|
||||
accelerator="Ctrl+Shift+R")
|
||||
self.window.bind_all('<Control-R>', self.replace)
|
||||
self.toolMenu.add_command(
|
||||
label="Paste on Pastebin", command=self.paste_on)
|
||||
self.toolMenu.add_command(
|
||||
label="Paste on Github Gists", command=self.gist)
|
||||
self.toolMenu.add_command(label="Read Aloud", command=self.speak)
|
||||
self.toolMenu.add_command(
|
||||
label="Spell Check", command=self.spell_check)
|
||||
|
||||
self.menuBar.add_cascade(label="Edit", menu=self.editMenu)
|
||||
self.menuBar.add_cascade(label="View", menu=self.viewMenu)
|
||||
self.menuBar.add_cascade(label="Tools", menu=self.toolMenu)
|
||||
self.helpMenu.add_command(label="About", command=self.about)
|
||||
self.menuBar.add_cascade(label="Help", menu=self.helpMenu)
|
||||
self.window.bind_all('<Return>', self.redraw)
|
||||
self.window.bind_all('<BackSpace>', self.redraw)
|
||||
self.window.bind_all('<Key>', self.redraw)
|
||||
self.window.bind_all('<Button-4>', self.redraw)
|
||||
self.window.bind_all('<Button-5>', self.redraw)
|
||||
self.window.bind_all('<Configure>', self.redraw)
|
||||
self.window.bind_all('<Motion>', self.redraw)
|
||||
self.editMenu.add_command(
|
||||
label="Select All", command=self.selectall, accelerator="Ctrl+A")
|
||||
self.window.bind_all('<Control-a>', self.selectall)
|
||||
|
||||
fontFamily = Menu(self.viewMenu)
|
||||
fontFamily.add_command(label="Helvetica (Default)", command=partial(
|
||||
self.change_font_family, "Helvetica"))
|
||||
fontFamily.add_command(label="Ubuntu", command=partial(
|
||||
self.change_font_family, "Ubuntu"))
|
||||
fontFamily.add_command(label="Times New Roman", command=partial(
|
||||
self.change_font_family, "Times New Roman"))
|
||||
fontFamily.add_command(label="Comic Sans MS", command=partial(
|
||||
self.change_font_family, "Comic Sans MS"))
|
||||
fontFamily.add_command(label="Terminal", command=partial(
|
||||
self.change_font_family, "Terminal"))
|
||||
self.viewMenu.add_cascade(label="Font Family", menu=fontFamily)
|
||||
|
||||
self.viewMenu.add_command(label="Font Size", command=self.change_font_size)
|
||||
|
||||
# self.viewMenu.add_command(label="Font Weight", command=self.change_font_weight)
|
||||
fontWeightMenu = Menu(self.viewMenu)
|
||||
fontWeightMenu.add_command(label="Normal", command=lambda: self.change_font_weight("normal"))
|
||||
fontWeightMenu.add_command(label="Bold", command=lambda: self.change_font_weight("bold"))
|
||||
self.viewMenu.add_cascade(label="Font Weight", menu=fontWeightMenu)
|
||||
|
||||
|
||||
themeBar = Menu(self.viewMenu)
|
||||
themeBar.add_command(label="Black", command=partial(
|
||||
self.change_theme, "black"))
|
||||
themeBar.add_command(label="White", command=partial(
|
||||
self.change_theme, "white"))
|
||||
themeBar.add_command(label="Aqua", command=partial(
|
||||
self.change_theme, "aqua"))
|
||||
themeBar.add_command(label="Matrix", command=partial(
|
||||
self.change_theme, "matrix"))
|
||||
themeBar.add_command(label="SnE Original", command=partial(
|
||||
self.change_theme, "sne"))
|
||||
self.viewMenu.add_cascade(label="Themes", menu=themeBar)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
self.open_specific_file(f"{default_path}/{sys.argv[1]}") # Open the specified file
|
||||
|
||||
|
||||
self.window.mainloop()
|
||||
|
||||
def new_file(self, event=None):
|
||||
if(messagebox.askyesno("Save?", "Do you wish to save current file?")):
|
||||
self.save_file()
|
||||
self.txt.delete('1.0', END)
|
||||
self.window.title("SnE - New File")
|
||||
self.currentFile = "No File"
|
||||
else:
|
||||
self.txt.delete('1.0', END)
|
||||
self.window.title("SnE")
|
||||
self.currentFile = "No File"
|
||||
|
||||
def open_file(self, event=None):
|
||||
# print("Opening file")
|
||||
myFile = filedialog.askopenfile(
|
||||
parent=self.window, mode="rb", title="Open a Note")
|
||||
if myFile is not None:
|
||||
self.window.title(os.path.basename(myFile.name))
|
||||
content = myFile.read()
|
||||
self.txt.delete('1.0', END)
|
||||
self.txt.insert(1.0, content)
|
||||
self.currentFile = myFile.name
|
||||
_log("SUCCESS", f"Opened Note {self.currentFile}")
|
||||
myFile.close()
|
||||
self.redraw(event)
|
||||
else:
|
||||
_log("ERROR", f"Note filename is empty ({self.currentFile=})")
|
||||
|
||||
def open_specific_file(self, file_path):
|
||||
try:
|
||||
with open(file_path, "rb") as myFile:
|
||||
self.window.title(os.path.basename(myFile.name))
|
||||
content = myFile.read()
|
||||
self.txt.delete('1.0', END)
|
||||
self.txt.insert(1.0, content)
|
||||
self.currentFile = myFile.name
|
||||
_log("SUCCESS", f"Opened Note {self.currentFile}")
|
||||
self.redraw(event)
|
||||
except Exception as e:
|
||||
_log("ERROR", f"Failed to open (specific) file: {str(e)}")
|
||||
|
||||
|
||||
# def save_file_as(self, event=None):
|
||||
# # print("Saving file")
|
||||
# myFile = filedialog.asksaveasfile(mode="w")
|
||||
# if myFile is not None:
|
||||
# myFile.write(self.txt.get('1.0', END))
|
||||
# self.currentFile = myFile.name
|
||||
# _log("SUCCESS", f"Saved New Note {self.currentFile}")
|
||||
# myFile.close()
|
||||
# self.window.title(os.path.basename(myFile.name))
|
||||
|
||||
|
||||
def save_file_as(self, event=None):
|
||||
try:
|
||||
# Read initial_directory from sd-input3.txt
|
||||
with open(os.path.expanduser("~/.shellnotes/util/shellnotes/sd/sd-input3.txt")) as f:
|
||||
initial_directory = f.read().strip()
|
||||
|
||||
# Prompt the user for a file name
|
||||
file_name = simpledialog.askstring("Save As", "Enter a file name:")
|
||||
if not file_name:
|
||||
_log("ERROR", f"No note name specified ({file_name=})")
|
||||
return
|
||||
|
||||
# Construct the full file path using initial_directory and file_name
|
||||
full_directory = os.path.expanduser(initial_directory)
|
||||
file_path = os.path.join(full_directory, file_name)
|
||||
|
||||
# Open and write to the file
|
||||
with open(file_path, "w+") as myFile:
|
||||
myFile.write(self.txt.get('1.0', END))
|
||||
self.currentFile = file_path
|
||||
_log("SUCCESS", f"Saved New Note {self.currentFile}")
|
||||
self.window.title(os.path.basename(self.currentFile))
|
||||
except Exception as e:
|
||||
# Handle any errors that might occur while saving
|
||||
_log("ERROR", f"Failed to save: {str(e)}")
|
||||
|
||||
|
||||
def save_file(self, event=None):
|
||||
# print(self.currentFile)
|
||||
if (self.currentFile == "No File"):
|
||||
self.save_file_as(event)
|
||||
else:
|
||||
myFile = open(self.currentFile, "w")
|
||||
myFile.write(self.txt.get('1.0', END))
|
||||
_log("SUCCESS", f"Saved Note {self.currentFile}")
|
||||
myFile.close()
|
||||
|
||||
|
||||
|
||||
def copy(self, event=None):
|
||||
# print("copying")
|
||||
self.txt.clipboard_clear()
|
||||
self.txt.clipboard_append(self.txt.selection_get())
|
||||
_log("INFO", f"Copied: {self.txt.selection_get()}")
|
||||
|
||||
def cut(self, event=None):
|
||||
self.copy()
|
||||
self.txt.delete(SEL_FIRST, SEL_LAST)
|
||||
|
||||
def paste(self, event=None):
|
||||
try:
|
||||
# Delete the selected text, if any
|
||||
sel_start = self.txt.index("sel.first")
|
||||
sel_end = self.txt.index("sel.last")
|
||||
if sel_start and sel_end:
|
||||
self.txt.delete(sel_start, sel_end)
|
||||
|
||||
# Paste the clipboard content at the cursor position
|
||||
self.txt.insert(INSERT, self.txt.clipboard_get())
|
||||
self.redraw(event)
|
||||
except:
|
||||
pass
|
||||
|
||||
def undo(self, event=None):
|
||||
self.txt.edit_undo()
|
||||
|
||||
def redo(self, event=None):
|
||||
self.txt.edit_redo()
|
||||
|
||||
def find(self, event=None):
|
||||
root = Toplevel(self.window)
|
||||
root.title("notegrep")
|
||||
root.transient(self.window)
|
||||
root.focus_force()
|
||||
root.grid_columnconfigure(0, weight=1)
|
||||
root.grid_rowconfigure(0, weight=1)
|
||||
e1 = ttk.Entry(root)
|
||||
e1.grid(row=0, column=0, pady="10",
|
||||
padx="10", columnspan=2, sticky="EW")
|
||||
|
||||
def sub():
|
||||
findString = e1.get()
|
||||
self.set_mark(findString)
|
||||
|
||||
def on_closing():
|
||||
self.txt.tag_delete('highlight')
|
||||
root.destroy()
|
||||
|
||||
findBtn = ttk.Button(root, text="Find...", command=sub)
|
||||
findBtn.grid(row=1, column=0, pady="10", padx="10", sticky="EWS")
|
||||
closeBtn = ttk.Button(root, text="Close", command=on_closing)
|
||||
closeBtn.grid(row=1, column=1, pady="10", padx="10", sticky="EWS")
|
||||
root.protocol("WM_DELETE_WINDOW", on_closing)
|
||||
|
||||
def paste_on(self, event=None):
|
||||
def copy_link(self, link):
|
||||
self.txt.clipboard_clear()
|
||||
self.txt.clipboard_append(link)
|
||||
root = Toplevel(self.window)
|
||||
root.title("PasteBin Link")
|
||||
root.transient(self.window)
|
||||
root.focus_force()
|
||||
root.grid_columnconfigure(0, weight=1)
|
||||
root.grid_rowconfigure(0, weight=1)
|
||||
link = pastebin.pastebin(self.txt.get('1.0', END))
|
||||
_log("SUCCESS", f"Uploaded Note to pastebin ({link})")
|
||||
lb = ttk.Label(root, text=link)
|
||||
lb.grid(row=0, column=0, padx="50", pady="20")
|
||||
bt = ttk.Button(root, text="Copy", command=copy_link(self, link))
|
||||
bt.grid(row=1, column=0, padx="50", pady="20")
|
||||
|
||||
|
||||
def gist(self, event=None):
|
||||
def copy_link(link):
|
||||
self.txt.clipboard_clear()
|
||||
self.txt.clipboard_append(link)
|
||||
try:
|
||||
text = self.txt.get('1.0', END)
|
||||
token = os.getenv("GH_TOKEN")
|
||||
if not token:
|
||||
messagebox.showerror("Error", "GH_TOKEN not set. You can set it using the shellnotes --set-github-token")
|
||||
_log("ERROR", "No github token.")
|
||||
|
||||
except:
|
||||
raise RuntimeError("GH_TOKEN not set")
|
||||
|
||||
|
||||
|
||||
try:
|
||||
link = create_gist(text, token)
|
||||
_log("SUCCESS", f"Uploaded Note to Github Gists ({link})")
|
||||
root = Toplevel(self.window)
|
||||
root.title("Github Gists Link")
|
||||
root.transient(self.window)
|
||||
root.focus_force()
|
||||
root.grid_columnconfigure(0, weight=1)
|
||||
root.grid_rowconfigure(0, weight=1)
|
||||
|
||||
lb = ttk.Label(root, text=link)
|
||||
lb.grid(row=0, column=0, padx="50", pady="20")
|
||||
bt = ttk.Button(root, text="Copy", command=lambda: copy_link(link))
|
||||
bt.grid(row=1, column=0, padx="50", pady="20")
|
||||
|
||||
except Exception as e:
|
||||
messagebox.showerror("Error", str(e))
|
||||
_log("ERROR", f"Couldn't upload to Github Gists ({str(e)})")
|
||||
|
||||
|
||||
def selectall(self, event=None):
|
||||
self.txt.tag_add('sel', '1.0', 'end')
|
||||
return "break"
|
||||
|
||||
def set_mark(self, findString):
|
||||
print("Coming to set mark")
|
||||
self.find_string(findString)
|
||||
self.txt.tag_config('highlight', foreground='red')
|
||||
self.txt.focus_force()
|
||||
|
||||
def find_string(self, findString):
|
||||
startInd = '1.0'
|
||||
while(startInd):
|
||||
startInd = self.txt.search(findString, startInd, stopindex=END)
|
||||
if startInd:
|
||||
startInd = str(startInd)
|
||||
lastInd = startInd+f'+{len(findString)}c'
|
||||
print(startInd, lastInd)
|
||||
self.txt.tag_add('highlight', startInd, lastInd)
|
||||
startInd = lastInd
|
||||
|
||||
def replace(self, event=None):
|
||||
# print("About to replace using notegrep")
|
||||
root = Toplevel(self.window)
|
||||
root.title("Find and Replace")
|
||||
root.transient(self.window)
|
||||
root.focus_force()
|
||||
root.grid_columnconfigure(0, weight=1)
|
||||
root.grid_rowconfigure(0, weight=1)
|
||||
e1 = ttk.Entry(root)
|
||||
e1.grid(row=0, column=0, pady=5, columnspan=2, padx=10)
|
||||
e2 = ttk.Entry(root)
|
||||
e2.grid(row=1, column=0, pady=5, columnspan=2, padx=10)
|
||||
|
||||
def find():
|
||||
findString = e1.get()
|
||||
self.set_mark(findString)
|
||||
|
||||
def replace():
|
||||
findString = e1.get()
|
||||
replaceString = e2.get()
|
||||
myText = self.txt.get('1.0', END)
|
||||
myText = myText.replace(findString, replaceString)
|
||||
self.txt.delete('1.0', END)
|
||||
self.txt.insert('1.0', myText)
|
||||
root.destroy()
|
||||
|
||||
def on_closing():
|
||||
self.txt.tag_delete('highlight')
|
||||
root.destroy()
|
||||
|
||||
findButton = ttk.Button(root, text="Find", command=find)
|
||||
replaceButton = ttk.Button(root, text="Replace", command=replace)
|
||||
findButton.grid(row=2, column=0, padx=10, pady=5)
|
||||
replaceButton.grid(row=2, column=1, padx=10, pady=5)
|
||||
root.protocol("WM_DELETE_WINDOW", on_closing)
|
||||
|
||||
def redraw(self, event=NONE):
|
||||
self.update_count(event)
|
||||
self.lineNumber.delete("all")
|
||||
self.objectIds = []
|
||||
si = self.txt.index("@0,0")
|
||||
while True:
|
||||
dline = self.txt.dlineinfo(si)
|
||||
if dline is None:
|
||||
break
|
||||
y = dline[1]
|
||||
liNum = str(si).split(".")[0]
|
||||
self.lineNumber.create_text(
|
||||
2, y, anchor="nw", text=liNum, fill=self.fontColor)
|
||||
si = self.txt.index(f"{si}+1line")
|
||||
|
||||
def update_count(self, event):
|
||||
count = self.txt.get('1.0', END)
|
||||
self.charCount.set(f"Characters: {len(count)-1}")
|
||||
|
||||
|
||||
|
||||
def speak(self):
|
||||
"""Read selected text aloud. Reads the whole note if nothing is selected."""
|
||||
engine = pyttsx3.init()
|
||||
try:
|
||||
selected_text = self.txt.selection_get()
|
||||
engine.say(selected_text)
|
||||
except tk.TclError:
|
||||
# If no text is selected, read the entire content of the text widget
|
||||
engine.say(self.txt.get("1.0", END))
|
||||
engine.runAndWait()
|
||||
|
||||
def spell_err(self, findString):
|
||||
"""Check for Spelling Errors"""
|
||||
startInd = '1.0'
|
||||
while True:
|
||||
startInd = self.txt.search(findString, startInd, stopindex=END, nocase=True)
|
||||
if not startInd:
|
||||
break
|
||||
endInd = f"{startInd}+{len(findString)}c"
|
||||
self.txt.tag_add('misspelled', startInd, endInd)
|
||||
startInd = endInd
|
||||
|
||||
def spell_check(self, event=NONE):
|
||||
print("Running Spell check")
|
||||
self.txt.tag_delete('misspelled')
|
||||
words = set(self.txt.get('1.0', "end-1c").split()) # Use a set to store unique words
|
||||
for word in words:
|
||||
if not self.word_exist(word):
|
||||
self.spell_err(word)
|
||||
|
||||
self.txt.tag_config('misspelled', background="red", foreground="white")
|
||||
|
||||
|
||||
def word_exist(self, word):
|
||||
d = enchant.Dict("en_US")
|
||||
return d.check(word)
|
||||
|
||||
def change_theme(self, theme):
|
||||
if (theme == "black"):
|
||||
self.fontColor = "white"
|
||||
self.window['theme'] = 'black'
|
||||
self.txt.config(bg="black", fg="white", insertbackground="white")
|
||||
self.txt['fg'] = 'white'
|
||||
self.lineNumber.config(bg="black")
|
||||
self.menuBar.config(bg="black", fg="white")
|
||||
pass
|
||||
elif (theme == "white"):
|
||||
self.fontColor = "black"
|
||||
self.window['theme'] = 'aquativo'
|
||||
self.lineNumber.config(bg="white")
|
||||
self.txt.config(bg="white", fg="black", insertbackground="black")
|
||||
self.menuBar.config(bg="white", fg="black")
|
||||
pass
|
||||
elif (theme == "matrix"):
|
||||
self.fontColor = "black"
|
||||
self.window['theme'] = 'black'
|
||||
self.lineNumber.config(bg="green")
|
||||
self.txt.config(bg="black", fg="green", insertbackground="white")
|
||||
self.menuBar.config(bg="green", fg="black", relief=RAISED)
|
||||
elif (theme == "aqua"):
|
||||
self.fontColor = "green"
|
||||
self.window['theme'] = 'arc'
|
||||
self.lineNumber.config(bg="#9de1fd")
|
||||
self.txt.config(bg="white", fg="black", insertbackground="black")
|
||||
self.menuBar.config(bg="#9de1fd", fg="black", relief=RAISED)
|
||||
elif (theme == "sne"):
|
||||
self.fontColor = "black"
|
||||
self.window['theme'] = 'kroc'
|
||||
self.lineNumber.config(bg="#eaddca")
|
||||
self.txt.config(bg="#997950", fg="black", insertbackground="black")
|
||||
self.menuBar.config(bg="black", fg="#eaddca", relief=RAISED)
|
||||
|
||||
def change_font_size(self):
|
||||
"""Adjust Font Size"""
|
||||
new_font_size = simpledialog.askstring(
|
||||
"Size", "Enter font size", parent=self.window)
|
||||
if new_font_size is not None:
|
||||
self.fontSize = new_font_size
|
||||
self.update_font()
|
||||
|
||||
def change_font_family(self, fontType):
|
||||
"""Change Font Family"""
|
||||
self.fontType = fontType
|
||||
self.update_font()
|
||||
|
||||
def change_font_weight(self, fontWeight):
|
||||
"""Adjust Font Weight"""
|
||||
self.fontWeight = fontWeight
|
||||
self.update_font()
|
||||
|
||||
|
||||
def update_font(self):
|
||||
self.txt.configure(font=(self.fontType, self.fontSize, self.fontWeight))
|
||||
|
||||
|
||||
def about(self):
|
||||
# print("Showing About Page")
|
||||
messagebox.showinfo("Shellnotes Note Editor (SNE)", "An editor used for viewing and editing your notes.\nVersion: 1.0")
|
||||
|
||||
def exit(self):
|
||||
if(messagebox.askyesno('Quit', 'Are you sure you want to quit?')):
|
||||
self.window.destroy()
|
||||
|
||||
|
||||
a = Editor()
|
|
@ -26,6 +26,7 @@ case $option in 1 )
|
|||
rm -rf ~/.shellnotes/ver 2>/dev/null
|
||||
rm -rf ~/.shellnotes/logs 2>/dev/null
|
||||
rm -rf ~/.shellnotes/def 2>/dev/null
|
||||
rm -rf ~/.shellnotes/sne 2>/dev/null
|
||||
rm -rf ~/.shellnotes/image 2>/dev/null
|
||||
cd ..
|
||||
rmdir .shellnotes
|
||||
|
|
|
@ -9,7 +9,11 @@ function clearlogs() {
|
|||
echo -n "Are you sure? " && read input
|
||||
case $input in Y|Yes|yes|y|YES )
|
||||
cd ~/.shellnotes/util/exec
|
||||
chmod +x clearlogs
|
||||
./clearlogs
|
||||
cd ../../logs/sne
|
||||
touch delete # In case directory is already empty
|
||||
/bin/rm -f *
|
||||
echo "[shellnotes] Logfiles cleared."
|
||||
esac
|
||||
cd $DIR
|
||||
|
|
|
@ -10,16 +10,18 @@ function resetshellnotes() {
|
|||
proceed() {
|
||||
echo "y\n" | clearlogs >/dev/null
|
||||
echo "" > ~/.shellnotes/util/listnotes/output/*
|
||||
echo "/usr/bin/gedit" > ~/.shellnotes/util/shellnotes/sd/sd-input1.txt
|
||||
echo ".shellnotes/sne/sne.py" > ~/.shellnotes/util/shellnotes/sd/sd-input1.txt
|
||||
echo "/bin/nano"> ~/.shellnotes/util/shellnotes/sd/sd-input2.txt
|
||||
echo "~/Notes" > ~/.shellnotes/util/shellnotes/sd/sd-input3.txt
|
||||
reset="
|
||||
|
||||
#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 (lines 10, 25, 40).
|
||||
|
||||
#The lines below must NOT be changed.
|
||||
export DIR="$(pwd)"
|
||||
|
||||
.~/.shellnotes/whatsnew.sh
|
||||
|
||||
. ~/.shellnotes/util/getv.sh
|
||||
. ~/.shellnotes/def/defaults.sh
|
||||
. ~/.shellnotes/util/ChMkDir.sh
|
||||
|
@ -34,6 +36,8 @@ export DIR="$(pwd)"
|
|||
. ~/.shellnotes/util/renamenote.sh
|
||||
. ~/.shellnotes/util/notewc.sh
|
||||
. ~/.shellnotes/util/notegrep.sh
|
||||
. ~/.shellnotes/util/clipnote.sh
|
||||
. ~/.shellnotes/util/rmdups.sh
|
||||
|
||||
|
||||
|
||||
|
@ -44,6 +48,9 @@ export DIR="$(pwd)"
|
|||
"
|
||||
|
||||
echo $reset > ~/.shellnotes/.shellnotes.sh
|
||||
# mv ~/.shellnotes/.shellnotes.sh ~/.shellnotes/shellnotes.sh
|
||||
rm -rf ~/.shellnotes/**/__pycache__
|
||||
echo "" > ~/.shellnotes/**/.env
|
||||
}
|
||||
|
||||
case $1 in -f | --force )
|
||||
|
@ -53,7 +60,7 @@ export DIR="$(pwd)"
|
|||
esac
|
||||
|
||||
echo "Be aware that this command will erase shellnotes' memory."
|
||||
echo "This contains default editors and folder, logfiles and user data and cache."
|
||||
echo "This contains default editors and folder, logfiles, user data and cache."
|
||||
echo "Your Notes will not be removed."
|
||||
echo -n "Proceed? " && read input
|
||||
case $input in y|Yes|Y|YES|yes)
|
||||
|
|
48
util/clipnote.sh
Normal file
48
util/clipnote.sh
Normal file
|
@ -0,0 +1,48 @@
|
|||
:<<'info'
|
||||
shellnotes - .clearlogs.sh
|
||||
(C) Dimitris Marakomihelakis
|
||||
Released under the "All rights reserved" category. See the RIGHTS.txt file
|
||||
in /docs/github/ for its full text.
|
||||
info
|
||||
|
||||
|
||||
function clipnote() {
|
||||
|
||||
function _write_clipboard() {
|
||||
if ! command -v xclip &> /dev/null; then
|
||||
echo "Error: xclip is not installed. Please install it."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clipboard_content=$(xclip -selection clipboard -o)
|
||||
echo "$clipboard_content" > $DEFAULT_PATH/$1
|
||||
}
|
||||
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "No note name given."
|
||||
echo -n "Enter note name: " && read input
|
||||
if [ -z "$input" ]; then
|
||||
echo "No input given."
|
||||
else
|
||||
_write_clipboard $input
|
||||
fi
|
||||
|
||||
else
|
||||
case $1 in
|
||||
-r | --reverse )
|
||||
if [ $# -eq 2 ]; then
|
||||
file_content=$(quickread "$2")
|
||||
echo -n "$file_content" | xclip -selection clipboard
|
||||
else
|
||||
echo "No note name given."
|
||||
echo "Usage: clipnote -r <notename>"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
_write_clipboard $1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
|
@ -44,4 +44,24 @@ function delnote() {
|
|||
fi
|
||||
fi
|
||||
cd $DIR
|
||||
}
|
||||
}
|
||||
|
||||
_delnote_completion() {
|
||||
local cur prev
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# Generate the list of files in the directory
|
||||
files=("$DEFAULT_PATH"/*)
|
||||
files_list="${files[@]##*/}" # Extract file names
|
||||
|
||||
case "$prev" in
|
||||
delnote)
|
||||
COMPREPLY=( $(compgen -W "${files_list}" -- "$cur") )
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _delnote_completion delnote
|
0
util/exec/clearlogs
Normal file → Executable file
0
util/exec/clearlogs
Normal file → Executable file
0
util/exec/disfailed
Normal file → Executable file
0
util/exec/disfailed
Normal file → Executable file
0
util/exec/enfailed
Normal file → Executable file
0
util/exec/enfailed
Normal file → Executable file
0
util/exec/ifailed
Normal file → Executable file
0
util/exec/ifailed
Normal file → Executable file
0
util/exec/sdfailed
Normal file → Executable file
0
util/exec/sdfailed
Normal file → Executable file
0
util/exec/ufailed
Normal file → Executable file
0
util/exec/ufailed
Normal file → Executable file
0
util/exec/uninfailed
Normal file → Executable file
0
util/exec/uninfailed
Normal file → Executable file
|
@ -30,6 +30,9 @@ function listnotes() {
|
|||
-f|--folder )
|
||||
. ~/.shellnotes/util/listnotes/f/f.sh
|
||||
;;
|
||||
-v|--view )
|
||||
. ~/.shellnotes/util/listnotes/v/v.sh
|
||||
;;
|
||||
*)
|
||||
if [ -z $1 ]; then
|
||||
if [ -z "$(ls -A $DEFAULT_PATH)" ]; then
|
||||
|
@ -44,3 +47,19 @@ function listnotes() {
|
|||
return 0
|
||||
cd $DIR
|
||||
}
|
||||
|
||||
_listnotes_completion() {
|
||||
local cur prev
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
case "$prev" in
|
||||
listnotes)
|
||||
COMPREPLY=( $(compgen -W "-d -n -f -v" -- "$cur") )
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _listnotes_completion listnotes
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1 +1 @@
|
|||
|
||||
4
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1 +0,0 @@
|
|||
|
16
util/listnotes/v/v.sh
Normal file
16
util/listnotes/v/v.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
:<<'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
|
||||
|
||||
echo "Press 'Q' to move from one note to the other."
|
||||
sleep 3
|
||||
|
||||
for file in "$DEFAULT_PATH"/*; do
|
||||
if [ -f "$file" ]; then
|
||||
echo "Displaying content of file: $file"
|
||||
less "$file"
|
||||
fi
|
||||
done
|
|
@ -7,11 +7,12 @@ info
|
|||
|
||||
function newnote() {
|
||||
DIR="$(pwd)"
|
||||
cd $DEFAULT_PATH
|
||||
$NOTES_EDITOR
|
||||
clear
|
||||
str="Note created in $DEFAULT_PATH"
|
||||
underlines=$(echo "$str" | tr -c '\010' '-')
|
||||
echo "$str\n$underlines"
|
||||
cd $HOME
|
||||
# echo $1
|
||||
NOTES_EDITOR
|
||||
# clear
|
||||
# str="Note created in $DEFAULT_PATH"
|
||||
# underlines=$(echo "$str" | tr -c '\010' '-')
|
||||
# echo "$str\n$underlines"
|
||||
cd $DIR
|
||||
}
|
|
@ -213,3 +213,25 @@ function notegrep() {
|
|||
cd $DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
_notegrep_completion() {
|
||||
local cur prev
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}" # Get the previous argument
|
||||
|
||||
# Generate the list of files in the directory
|
||||
files=("$DEFAULT_PATH"/*)
|
||||
files_list="${files[@]##*/}" # Extract file names
|
||||
|
||||
case "$prev" in
|
||||
notegrep)
|
||||
COMPREPLY=( $(compgen -W "-cf -cl -m -sc -sf -sl -ws" -- "$cur") )
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W "${files_list}" -- "$cur") )
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _notegrep_completion notegrep
|
|
@ -28,4 +28,24 @@ function notewc() {
|
|||
|
||||
cd $DIR
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_notewc_completion() {
|
||||
local cur prev
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# Generate the list of files in the directory
|
||||
files=("$DEFAULT_PATH"/*)
|
||||
files_list="${files[@]##*/}" # Extract file names
|
||||
|
||||
case "$prev" in
|
||||
notewc)
|
||||
COMPREPLY=( $(compgen -W "${files_list}" -- "$cur") )
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _notewc_completion notewc
|
|
@ -55,4 +55,26 @@ function quickread() {
|
|||
fi
|
||||
|
||||
cd $DIR
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_quickread_completion() {
|
||||
local cur prev
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}" # Get the previous argument
|
||||
|
||||
# Generate the list of files in the directory
|
||||
files=("$DEFAULT_PATH"/*)
|
||||
files_list="${files[@]##*/}" # Extract file names
|
||||
|
||||
case "$prev" in
|
||||
quickread)
|
||||
COMPREPLY=( $(compgen -W "-l -r -s" -- "$cur") )
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W "${files_list}" -- "$cur") )
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _quickread_completion quickread
|
|
@ -10,32 +10,56 @@ function readnote() {
|
|||
if [ $# -eq 0 ]; then
|
||||
echo -n "Enter note name: " && read notename
|
||||
else
|
||||
notename=$1
|
||||
notename="$1"
|
||||
fi
|
||||
|
||||
if [ -z $notename ]; then
|
||||
if [ -z "$notename" ]; then
|
||||
echo "Invalid input."
|
||||
return 0
|
||||
|
||||
else
|
||||
|
||||
cd $DEFAULT_PATH
|
||||
if [ -e $notename ]; then
|
||||
chmod 0444 $notename
|
||||
$NOTES_EDITOR $notename
|
||||
chmod +rw $notename
|
||||
if [ -e "$notename" ]; then
|
||||
cd "$HOME"
|
||||
# chmod 0444 $notename
|
||||
NOTES_EDITOR "$notename"
|
||||
# chmod +rw $notename
|
||||
|
||||
else
|
||||
clear
|
||||
echo "No such note."
|
||||
echo -n "Do you want to create one?[Y/N]: " && read create;
|
||||
|
||||
case $create in y|Y|YES|Yes|yes )
|
||||
newnote
|
||||
esac
|
||||
fi
|
||||
|
||||
case $create in y|Y|YES|Yes|yes )
|
||||
$NOTES_EDITOR
|
||||
esac
|
||||
|
||||
|
||||
clear
|
||||
cd $DIR
|
||||
# clear
|
||||
cd "$DIR"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_readnote_completion() {
|
||||
local cur prev
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# Generate the list of files in the directory
|
||||
files=("$DEFAULT_PATH"/*)
|
||||
files_list="${files[@]##*/}" # Extract file names
|
||||
|
||||
case "$prev" in
|
||||
readnote)
|
||||
COMPREPLY=( $(compgen -W "${files_list}" -- "$cur") )
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _readnote_completion readnote
|
|
@ -47,4 +47,25 @@ function renamenote() {
|
|||
cd $DIR
|
||||
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_renamenote_completion() {
|
||||
local cur prev
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# Generate the list of files in the directory
|
||||
files=("$DEFAULT_PATH"/*)
|
||||
files_list="${files[@]##*/}" # Extract file names
|
||||
|
||||
case "$prev" in
|
||||
renamenote)
|
||||
COMPREPLY=( $(compgen -W "${files_list}" -- "$cur") )
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _renamenote_completion renamenote
|
66
util/rmdups.sh
Normal file
66
util/rmdups.sh
Normal file
|
@ -0,0 +1,66 @@
|
|||
:<<'info'
|
||||
shellnotes - rmdups.sh
|
||||
(C) Dimitris Marakomihelakis
|
||||
Released under the "All rights reserved" category. See the RIGHTS.txt file
|
||||
in /docs/github/ for its full text.
|
||||
info
|
||||
|
||||
function rmdups() {
|
||||
|
||||
_rmdups() {
|
||||
result="$(awk '!seen[$0]++' $1)"
|
||||
echo "$result"
|
||||
echo -n "Replace $notename with the above text?[Y\N]: " && read proceed
|
||||
case "$proceed" in
|
||||
Y|y|yes|YES|Yes )
|
||||
echo "$result" > $notename
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
DIR="$(pwd)"
|
||||
if [ $# -eq 0 ]; then
|
||||
echo -n "Enter the name of the note whose duplicates you wish to delete: " && read notename
|
||||
else
|
||||
notename=$1
|
||||
fi
|
||||
|
||||
if [ -z $notename ]; then
|
||||
echo "Invalid input."
|
||||
return 0
|
||||
|
||||
else
|
||||
cd $DEFAULT_PATH
|
||||
|
||||
if [ -e $notename ]; then
|
||||
_rmdups "$notename"
|
||||
else
|
||||
echo "Invalid argument or parameter given."
|
||||
cd $DIR
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $DIR
|
||||
|
||||
}
|
||||
|
||||
_rmdups_completion() {
|
||||
local cur prev
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# Generate the list of files in the directory
|
||||
files=("$DEFAULT_PATH"/*)
|
||||
files_list="${files[@]##*/}" # Extract file names
|
||||
|
||||
case "$prev" in
|
||||
rmdups)
|
||||
COMPREPLY=( $(compgen -W "${files_list}" -- "$cur") )
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _rmdups_completion rmdups
|
|
@ -14,6 +14,7 @@ function shellnotes() {
|
|||
. ~/.shellnotes/util/shellnotes/au/au.sh
|
||||
. ~/.shellnotes/util/shellnotes/sd/sd.sh
|
||||
. ~/.shellnotes/util/shellnotes/i/i.sh
|
||||
. ~/.shellnotes/util/shellnotes/gh_token/gh_token.sh
|
||||
if [[ $# > 1 ]]; then
|
||||
echo "Too many arguments."
|
||||
elif [[ $# = 0 ]];then
|
||||
|
|
34
util/shellnotes/gh_token/gh_token.sh
Normal file
34
util/shellnotes/gh_token/gh_token.sh
Normal file
|
@ -0,0 +1,34 @@
|
|||
:<<'info'
|
||||
shellnotes - gh_token.sh
|
||||
(C) Dimitris Marakomihelakis
|
||||
Released under the "All rights reserved" category. See the RIGHTS.txt file
|
||||
in /docs/github/ for its full text.
|
||||
info
|
||||
|
||||
ght() {
|
||||
echo -n "Enter your Github Gists Token: " && read input
|
||||
if [ -z "$input" ]; then
|
||||
echo "No input given."
|
||||
return 1
|
||||
else
|
||||
echo "GH_TOKEN=$input" > ~/.shellnotes/sne/.env && echo "Successfully saved token to ~/.shellnotes/sne/.env .\nDo not share it with anyone."
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in -ght|--set-github-token )
|
||||
if [ -s ~/.shellnotes/sne/.env ]; then
|
||||
str="Your Github Gists Token"
|
||||
underlines=$(echo "$str" | tr -c '\010' '-')
|
||||
echo "$str\n$underlines"
|
||||
cat ~/.shellnotes/sne/.env
|
||||
echo "\n\nThis will be used when pasting your notes as gists via SnE (Shellnotes Notes Editor)."
|
||||
echo -n "Would you like to change it? [Y/N]: " && read input
|
||||
case $input in Yes|y|Y|yes|YES )
|
||||
ght
|
||||
esac
|
||||
else
|
||||
echo "No Github Gists Token Found."
|
||||
ght
|
||||
fi
|
||||
|
||||
esac
|
|
@ -16,6 +16,7 @@ case $1 in -l|--logs )
|
|||
echo "4. update errors"
|
||||
echo "5. uninstallation errors"
|
||||
echo "6. set-defaults errors"
|
||||
echo "7. SnE INFO/SUCCESS/ERROR messages"
|
||||
echo
|
||||
echo "For more info about which one to choose, read /docs/system/loggingsystem.txt"
|
||||
echo
|
||||
|
@ -37,6 +38,8 @@ case $1 in -l|--logs )
|
|||
less ~/.shellnotes/logs/uninfailed.txt
|
||||
elif [ $input = 6 ]; then
|
||||
less ~/.shellnotes/logs/sdfailed.txt
|
||||
elif [ $input = 7 ]; then
|
||||
less ~/.shellnotes/logs/sne/*
|
||||
else
|
||||
echo "Invalid input."
|
||||
fi
|
||||
|
|
|
@ -1 +1 @@
|
|||
/usr/bin/gedit
|
||||
.shellnotes/sne/sne.py
|
||||
|
|
|
@ -1 +1 @@
|
|||
3.5
|
||||
4.0
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#See what's new after opening your terminal
|
||||
|
||||
echo -n "Shellnotes is running version 3.5 for the first time.\nWant to see what's new?(Y/N): " && read show
|
||||
version="4.0"
|
||||
|
||||
echo -n "Shellnotes is running version $version for the first time.\nWant to see what's new?(Y/N): " && read show
|
||||
|
||||
case $show in
|
||||
y | yes | Y | Yes | YES )
|
||||
|
|
62
whatsnew.txt
62
whatsnew.txt
|
@ -1,36 +1,36 @@
|
|||
Shellnotes 3.5 Updates
|
||||
6/7/2021
|
||||
Shellnotes 4.0 Changelog
|
||||
20/8/2023
|
||||
|
||||
Total Changes: 73
|
||||
|
||||
Additions:
|
||||
|
||||
- `notegrep`: new command for manipulating notes with grep's tools
|
||||
- Added parameters and improved `quickread`
|
||||
- Added the set-defaults.sh log as an option in the logfile viewer (`shellnotes -l`).
|
||||
- `shellnotes -i` or `--info`: Information about your shellnotes copy
|
||||
- Added manpages for hidden commands (`clearlogs`, `resetshellnotes`)
|
||||
- `resetshellnotes -f` or `--force`: Avoid prompt when resetting shellnotes.
|
||||
- **SnE**: The new default text editor for the `newnote` & `readnote` commands. Written in python, it is lightweight and safe.
|
||||
-SnE (Shellnotes Notes Editor) and its requirements (requirements.txt) will be installed alongside shellnotes.
|
||||
-You can choose from a vast amount of tools to manipulate your notes, like notegrep.
|
||||
-It has built-in features like spell checking and text-to-speech.
|
||||
-You can applly different themes to match it to your liking.
|
||||
-You can paste your Notes on pastebin or on Github as Gists (you'll need a Github API Token, which you can set using `shellnotes -ght`).
|
||||
-SnE uses the loguru module to save logfiles that contain information your sessions, which you can view with `shellnotes -l`.
|
||||
You can always change the default editor using `shellnotes -sd`.
|
||||
|
||||
-New listnotes option: You can now view each and every one of your notes in your Notes folder via the `listnotes --view` or `listnotes -v` command. It basically runs `less` inside of your Notes folder.
|
||||
|
||||
- `rmdups`: A new command that uses `awk` to safely remove duplicate lines in a note. Use with caution.
|
||||
|
||||
- `clipnote`: You are now able to paste the contents of your clipboard to a new note instantly, or, by using `-r`/`--reverse` as a parameter, take the text from the note and copy it to your clipboard. This new command takes advantage of the `xclip` package.
|
||||
|
||||
- Command autocompletion & file suggestions: `delnote`, `listnotes`, `newnote`, `notegrep`, `notewc`, `quickread`, `readnote` and `renamenote` can now suggest the user possible options (arguments) and/or list the user's notes when the `<Tab>` key is pressed after the command is typed.
|
||||
|
||||
Fixes:
|
||||
|
||||
- Fixed clearlogs.sh generating empty logfiles inside `/exec`
|
||||
- Fixed bug #116 `-DynamicOutputBug`: "listnotes -d output generates autoscroll, instead of starting from where the command was executed."
|
||||
- Fixed "\n" input resulting in an error
|
||||
- Fixed auto-update illegal math bug
|
||||
- Fixed not returning to previous directory bug
|
||||
- Fixed bug #72 `-WithoutStringBug`: "If there are no matches in the input, "notegrep -ws" will display the file as is."
|
||||
- Logfiles are no longer duplicated inside `util/`
|
||||
|
||||
Updates & Changes:
|
||||
|
||||
- Reorganized scripts under `util/`
|
||||
- Optimized the install script (`install.sh`)
|
||||
- Enhanced all manpages
|
||||
- New logging method: Logging directly from executables, in order for the process to take less time (clears logfiles with same method)
|
||||
- Updated Documentation
|
||||
- Reorganized the logfile system
|
||||
- Removed syntax files (stored in `util/.syntax/`)
|
||||
- Changed `listnotes` output: It's more traditional now
|
||||
- Renamed `noteinfo` to `notewc` as it uses the `wc` command & changed its output
|
||||
- `resetshellnotes` now resets the user's shell
|
||||
- Optimized hidden commands
|
||||
- Updated documentation (fixed grammar and spelling mistakes, removed unnecessary details, add new info for SnE)
|
||||
- Updated install.sh and uninstall.sh to support SnE & new commands.
|
||||
|
||||
Notes:
|
||||
|
||||
|
@ -42,14 +42,12 @@ Notes:
|
|||
|
||||
(Ignore the 80's ASCII art.)
|
||||
|
||||
Welcome to shellnotes 3.5!
|
||||
Welcome to shellnotes 4.0!
|
||||
|
||||
This version brings many bug fixes as well as additions for shellnotes!
|
||||
Starting with the main feature of the update, `notegrep` is a tool that can be used on a daily basis. It simply uses grep to change the way you read your notes. You can experiment this new tool as well as a variety of options (split-character, without-character, multiple patterns and files and more).
|
||||
The biggest improvement of 3.5 must be `quickread`. There are some new parameters you can play with, or you can just test its new error-handling ability.
|
||||
Let's not forget the bug fixes: It's even safer to use shellnotes without worrying about errors occuring.
|
||||
And last, shellnotes is now way faster than before. Instead of compiling loggers on the go, shellnotes uses pre-existing executables to speed up the process.
|
||||
|
||||
Still don't know what's going on? Read the manpages! By the way, the manpages got updated as well...
|
||||
It's been a while.
|
||||
I haven't had the time to work on this project, since many personal issues and responsibilities use most of my time. After almost three years, however, we're back with another update. Shellnotes 4 introduces new tools and commands such as `clipnote`, `rmdups` and `SnE`; a new GUI text editor for your notes. It also enhances the user's experience with command autocompletion and file suggestions for most commands. Try experimenting with it!
|
||||
I feel like this project is getting bigger than it should. All the main features of shellnotes have been covered quite a long time ago, however I always try and add as many new stuff as possible. I learn a lot of new things in the process but, after all, the project ends up being overcomplicated and hard to maintain. Few people use it anyway.
|
||||
If I have enough time in the next months I will try and rewrite the main parts of shellnotes and optimize the program as much as possible, as it looks really messy and non-professional. I don't really think there's much more to add to it and I think I should move on.
|
||||
In any case, I'll try and have as much fun as possible.
|
||||
|
||||
Have fun taking notes!
|
Loading…
Reference in a new issue