Added an error for when the configured text editor cannot be found on the system

Former-commit-id: f41356854b88cf6a53604ef37025667d17041da7
Former-commit-id: 627cb9298583b7fbb6358edead75c65e671619d0
This commit is contained in:
2023-09-24 15:04:36 -04:00
parent 9ba4b8d724
commit e4fbcd6825
+5 -2
View File
@@ -123,7 +123,10 @@ def edit_note(_note_lines, _exit_on_match=False):
with NamedTemporaryFile(mode='w+') as _tmp:
_tmp.write(_joined_note_lines)
_tmp.seek(0)
run((editor, _tmp.name))
try:
run((editor, _tmp.name))
except FileNotFoundError:
print(f"\n\u001b[38;5;9merror: the configured text editor ({editor}) cannot be found on this system\n\nplease either install the editor or re-configure the active editor using 'sshyp tweak'\u001b[0m\n")
_tmp.seek(0)
_new_note = _tmp.read().rstrip()
if _exit_on_match and _joined_note_lines == _new_note:
@@ -717,7 +720,7 @@ if __name__ == "__main__":
sync('\n')
elif offline_mode_enabled == 'true':
print("\n\u001b[38;5;9mwarning: sshyp is currently configured in offline mode - ssh synchronization is "
"disabled\n")
"disabled\u001b[0m\n")
# PORT START ARGS-SERVER
# server arguments