Skip to content

Commit

Permalink
cli: simplify exit conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed Oct 9, 2023
1 parent 4927e01 commit b6d2bad
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions software/script/chameleon_cli_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def startCLI(self):
raise Exception("This script requires at least Python 3.9")

self.print_banner()
closing = False
cmd_strs = []
while True:
if cmd_strs:
Expand All @@ -115,19 +114,17 @@ def startCLI(self):
cmd_strs = cmd_str.replace(
"\r\n", "\n").replace("\r", "\n").split("\n")
cmd_str = cmd_strs.pop(0)
if cmd_str == "":
continue
except EOFError:
closing = True
cmd_str = 'exit'
except KeyboardInterrupt:
closing = True
cmd_str = 'exit'

# look for alternate exit
if closing or cmd_str in ["quit", "q", "e"]:
if cmd_str in ["quit", "q", "e"]:
cmd_str = 'exit'

# empty line
if cmd_str == "":
continue

# look for alternate comments
if cmd_str[0] in ";#%":
cmd_str = 'rem ' + cmd_str[1:].lstrip()
Expand Down

0 comments on commit b6d2bad

Please sign in to comment.