Skip to content

Commit

Permalink
Update v2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
gamerYazilimci45 committed Oct 18, 2024
1 parent 3bd1fde commit d92da80
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 25 deletions.
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
# TermiNote
Terminal based note app for terminal users.

# TermiNote 2.3 is available for download!
# TermiNote 2.5 is available for download!

You can download it from Releases.

> *Warning: If you use v2.0 or v2.1 ``linuxsetup.sh`` is not working. This file is deleted in latest version.(v2.3)*
## How to download?

You can download latest version from Releases.
Expand Down Expand Up @@ -46,20 +44,31 @@ Create notes in the folder you are in with the ``create`` command and use these
### List Your Notes
List your notes with ``list`` command.

### Import Your Files/Notes:
### Import Your Files/Notes
You can import your files or notes with ``import`` command.

### Export Your Notes:
### Export Your Notes
You can export your notes with ``export``command.

### Delete Your Notes
You can delete old and unnecessary notes with the ``delete`` or ``remove`` command.

### Change Note File Format
You can change file format with ``settings`` command or you can directly edit ``config.ini`` .(.*)

## Other News:
- Now, TermiNote use ``UTF-8`` for encoding to notes.
- ``import`` and ``export`` commands use ``shutil`` library. Therefore ``shutil`` library is import to project.
- In update v2.3, TermiNote commands is a cyan. But error colors is red. Therefore ``colorama`` library is import to project.
- ``linuxsetup.sh`` is deleted in new version. Because is not working.
- Added config file(.ini)
- Added ``configparser`` library for parsing the config file.
- Now, you change the note file format. (.txt, .md, oth.)
- Now, note tags is not writing head the note, they writing end the note.

## Imported libraries in project:
- sys
- os
- shutil
- colorama
- configparser


## Warnings:
> This project is using "GNU GENERAL PUBLIC LICENSE"!
Expand Down
4 changes: 4 additions & 0 deletions config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[file]
extension = .txt; file format


45 changes: 29 additions & 16 deletions terminote.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
import os
import shutil
from colorama import Fore
import configparser

config = configparser.ConfigParser()
config.read('config.ini')

default_extension = config["file"]["extension"]

notes_folder = "notes/"

Expand All @@ -10,45 +16,40 @@

if len(sys.argv) != 2:
print(Fore.RED,"Usage on Windows: python terminote.py <option>")
print(Fore.RED,"Usage on Linux: terminote <option>")
print(Fore.RED,"Usage on Linux: python terminote.py <option>")
else:
command = sys.argv[1]
print(Fore.CYAN," ",end="")
if command == "create":
not_name = input("Not name: \n> ")
not_value = input("Not contents: \n> ")
not_tags = input("Not tags(optional): \n> ")
not_file_name = notes_folder + not_name + ".txt"
not_file_name = notes_folder + not_name + str(default_extension)
try:
with open(not_file_name,"w",encoding="UTF-8") as not_file:
not_file.write(not_tags + "\n" + not_value)
not_file.write(not_value + "\n" + "Your tags: " + not_tags)
print(f"Note is succesfully created at: {not_file_name}")
except Exception as e:
print(Fore.RED,f"Error: {e}")
elif command == "show":
not_name = input("Not name: \n> ")
not_file_name = notes_folder + not_name + ".txt"
not_file_name = notes_folder + not_name + str(default_extension)
try:
with open(not_file_name,"r",encoding="UTF-8") as not_file:
lines = not_file.readlines()
note = [line.strip() for line in lines[1:]]
print(note)
note_tag = lines[0].strip()
if note_tag == "": note_tag = "No note tags is found."
print(f"Tags: {note_tag}")
print(not_file.read())
except Exception as e:
print(Fore.RED,f"Error: {e}")
elif command == "delete" or command == "remove":
not_name = input("Not name: \n> ")
not_file_name = notes_folder + not_name + ".txt"
not_file_name = notes_folder + not_name + str(default_extension)
try:
os.remove(not_file_name)
print("Note is succesfully deleted.")
except Exception as e:
print(Fore.RED,f"Error: {e}")
elif command == "edit":
not_name = input("Not name: \n> ")
not_file_name = notes_folder + not_name + ".txt"
not_file_name = notes_folder + not_name + str(default_extension)
try:
with open(not_file_name, "r",encoding="UTF-8") as not_file:
note = not_file.read()
Expand All @@ -61,15 +62,15 @@
print(Fore.RED,f"Error: {e}")
elif command == "rename":
not_name = input("Not name: \n> ")
not_file_name = notes_folder + not_name + ".txt"
not_file_name = notes_folder + not_name + str(default_extension)
try:
new_name = notes_folder + input("New Name: ") + ".txt"
os.rename(not_file_name, new_name)
print("Note is succesfully renamed.")
except Exception as e:
print(Fore.RED,f"Error: {e}")
elif command == "search":
search_value = input("Not name: \n > ") + ".txt"
search_value = input("Not name: \n > ") + str(default_extension)
note_lists = os.listdir(notes_folder)
if search_value in note_lists:
print(f"Note is founded: {notes_folder + search_value}")
Expand All @@ -80,7 +81,7 @@
elif command == "export":
try:
not_name = input("Not name: \n > ")
not_file_name = notes_folder + not_name + ".txt"
not_file_name = notes_folder + not_name + str(default_extension)
export_path = input("Path to export: \n > ")
shutil.copy(not_file_name, export_path)
except Exception as e:
Expand All @@ -91,7 +92,19 @@
shutil.copy(import_path, "./notes")
except Exception as e:
print(Fore.RED,f"Error: {e}")

elif command == "settings":
config.read('config.ini')

extension = config['file']['extension']
print(Fore.GREEN,f"Note File Extension: {extension}")
yn = input("Do you want change file format?(y,n): ")
if yn == "y":
print(Fore.CYAN," ",end=" ")
file_extension = input("New file format(.*): ")
config.read('config.ini')
config["file"]["extension"] = str(file_extension)
with open('./config.ini','w',encoding="UTF-8") as config_file:
config.write(config_file)
else:
print(f"Unknown command: {sys.argv[1]}")

Expand Down

0 comments on commit d92da80

Please sign in to comment.