Make do_quit() silent, move the farewell message to main().

This commit is contained in:
Solderpunk 2023-11-19 14:40:26 +01:00
parent 4df88896a8
commit 305f7f9f2c
1 changed files with 13 additions and 5 deletions

18
av98.py
View File

@ -256,6 +256,7 @@ class GeminiClient(cmd.Cmd):
"redirects_followed": 0
}
self._stop = False
self._init_config()
ui_out.debug("Raw buffer: ", self.raw_file_buffer)
ui_out.debug("Rendered buffer: ", self.rendered_file_buffer)
@ -877,6 +878,9 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
# Cmd implementation follows
def postcmd(self, stop, line):
return self._stop
def default(self, line):
"""
This is called when none of the do_* methods match the user's
@ -1378,10 +1382,8 @@ current gemini browsing session."""
self.client_cert_manager.cleanup()
# Apply permanent redirects to bookmarks
self._maintain_bookmarks()
# Say goodbye
print()
print("Thank you for flying AV-98!")
sys.exit()
# Exit command loop
self._stop = True
do_exit = do_quit
@ -1448,12 +1450,18 @@ def main():
gc.cmdqueue.append("tour %s" % url)
gc.cmdqueue.append("tour")
# Endless interpret loop
# Endless interpret loop until user quits
while True:
try:
gc.cmdloop()
break
except KeyboardInterrupt:
print("")
# Say goodbye
print()
print("Thank you for flying AV-98!")
sys.exit()
if __name__ == '__main__':
main()