Update terminis.py

This commit is contained in:
adrienmalin 2019-02-15 12:36:25 +01:00
parent dbf3b04279
commit 2a83769797

View File

@ -378,7 +378,7 @@ class Stats(Window):
try: try:
self.level = int(sys.argv[1]) self.level = int(sys.argv[1])
except ValueError: except ValueError:
usage() print_help()
sys.exit(1) sys.exit(1)
else: else:
self.level = max(1, self.level) self.level = max(1, self.level)
@ -522,7 +522,7 @@ class Controls(Window, configparser.SafeConfigParser):
# See https://docs.python.org/3/library/curses.html?highlight=curses#constants # See https://docs.python.org/3/library/curses.html?highlight=curses#constants
""" """
) )
self.write(f) self.write(f)
except Exception as e: except Exception as e:
print("Configuration could not be saved:") print("Configuration could not be saved:")
@ -736,11 +736,16 @@ def edit():
subprocess.call(["${EDITOR:-vi}", Controls.FILE_PATH]) subprocess.call(["${EDITOR:-vi}", Controls.FILE_PATH])
def print_help(): def print_help():
print("Usage:") print(
print("terminis [--edit|--help|n]") """terminis [--edit|--help|n]
print(" --edit: edit controls in text editor")
print(" --help: show command usage (this message)") Tetris clone for terminal
print(" n (integer between 1 and 15): start at level n")
--edit: edit controls in text editor
--help: show command usage (this message)
n (integer between 1 and 15): start at level n
"""
)
if __name__ == "__main__": if __name__ == "__main__":