Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified eno/scripts/README.md
100644 → 100755
Empty file.
Empty file modified eno/scripts/affirmations.sh
100644 → 100755
Empty file.
Empty file modified eno/scripts/config.rc.example
100644 → 100755
Empty file.
Empty file modified eno/scripts/echo.py
100644 → 100755
Empty file.
Empty file modified eno/scripts/platforminfo.py
100644 → 100755
Empty file.
Empty file modified eno/scripts/rssread.py
100644 → 100755
Empty file.
Empty file modified eno/scripts/whoami.py
100644 → 100755
Empty file.
20 changes: 20 additions & 0 deletions room.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
paths:
- /home/matrix/bin
rooms:
- regex: room_name_1
cmd: command
args: args
help: help
markdown_convert: True
formatted: True
code: True
split: split
- regex: room_name_2
cmd: command
args: args
help: help
markdown_convert: True
formatted: False
code: False
split: split

19 changes: 8 additions & 11 deletions room_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ def load(self, room_dict_filepath):
with open(room_dict_filepath) as fobj:
logger.debug(f"Loading room dictionary at {room_dict_filepath}")
self.room_dict = yaml.safe_load(fobj.read())

if "rooms" in self.room_dict.keys():
self.rooms = self.room_dict["rooms"]

else:
print("no rooms key in self.rooms")
if "paths" in self.room_dict.keys():
os.environ["PATH"] = os.pathsep.join(self.room_dict["paths"]+[os.environ["PATH"]])
logger.debug(f'Path modified. Now: {os.environ["PATH"]}.')

else:
print("no paths in room_dict keys")
except FileNotFoundError:
logger.error(f"File not found: {room_dict_filepath}")

return

def is_empty(self):
Expand Down Expand Up @@ -122,10 +122,7 @@ def assert_sanity(self):
if "rooms" in self.room_dict.keys():
for com in self.room_dict["rooms"]:
# Implement rule 3
if type(self.room_dict["rooms"][com]) != dict:
raise RoomDictSanityError(
"Defined rooms must be dictionaries.")
for opt in self.room_dict["rooms"][com].keys():
for opt in com.keys():
# Implement rule 4
if opt not in ("regex",
"cmd",
Expand All @@ -140,14 +137,14 @@ def assert_sanity(self):
f"\"{opt}\".")
# Implement rule 6
elif opt in ("markdown_convert", "formatted", "code"):
if type(self.room_dict["rooms"][com][opt]) != bool:
if type(com[opt]) != bool:
raise RoomDictSanityError(
f"In room \"{com}\", invalid value for option "
f"\"{opt}\" found: " \
f"\"{self.room_dict['rooms'][com][opt]}\"")
f"\"{com[opt]}\"")
# Implement rule 5
else:
if type(self.room_dict["rooms"][com][opt]) != str:
if type(com[opt]) != str:
raise RoomDictSanityError(
f"In room \"{com}\", room option " \
f"\"{opt}\" must be a string.")
Expand Down