diff options
author | Thing2 <thing2@seacrossedlovers.xyz> | 2025-02-19 12:32:55 -0700 |
---|---|---|
committer | Thing2 <thing2@seacrossedlovers.xyz> | 2025-02-19 12:32:55 -0700 |
commit | 0030bddae193f7e60b52ade742622b03d94c30f4 (patch) | |
tree | d97dc77a37b88fe9925c28892fee9960135eba59 | |
parent | 953d413a379ed8616db3266d9eef0bab2fd868b6 (diff) |
let the program open .gn files and started the command prompts
-rw-r--r-- | goatNote.py | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/goatNote.py b/goatNote.py index ff76bd6..efd62c3 100644 --- a/goatNote.py +++ b/goatNote.py @@ -21,9 +21,10 @@ class date: # Tokenizing # TODO ADD SPACES TO HEADING TODO +#regEX def tokenize(file: str): headingRe = r"\s*\*\s*([A-z0-9]+)\s*\*\s*\[(\d\d\d\d[.]\d\d[.]\d\d)\]\s*{(TO[.]DO|DONE)}\s*" - bulletPointRe = r"-\s*([A-z0-9]+)\s*" + bulletPointRe = r"-\s*((\s|[A-z0-9])+)\s*" unprocessed = [] end = False @@ -67,14 +68,24 @@ def tokenize(file: str): return values, types -values, types = tokenize(""" - *heading* [1004.23.23] {TO.DO} - - hi - - hey - *heading* [1004.23.23] {TO.DO} - - hi - - hey -""") + +# Put user into shell then ask for which file to read from +fileName = input("Which GOATED file do you wanna read?? \n") +if fileName == "": + fileName = "~/.global.gn" + +if ".gn" not in fileName: + print("That's not a goatNote file! Silly goose! Automatically putting into the global file!") + fileName = "~/.global.gn" + +try: + file = open(fileName, "r").read() +except: + print("ABORT MISSION (couldn't open file)", fileName, "does not exist") + exit(1) + +values, types = tokenize(file) + # Drop user into a shell print("enter one of the following commands: list, toggle, change date, view, formatting help, or type close to exit program") @@ -83,7 +94,10 @@ line = input(": ") while line != "close": if line == "list": - print("you said to list :)") + for i in range(len(types)): + if types[i] == tokenTypes.HEADING: + print(values[i]) + elif line == "toggle": print("You said toggle :(") elif line == "change date": |