From f4a1f4f251d6fa895cec059d335c1880e54854b4 Mon Sep 17 00:00:00 2001 From: adrienmalin <41926238+adrienmalin@users.noreply.github.com> Date: Fri, 15 Feb 2019 12:30:04 +0100 Subject: [PATCH] use -- style command options --- README.md | 6 +++--- terminis/terminis.py | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6f33be4..c3a742d 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ pip install --user terminis ## Usage ```bash -terminis [edit|help|n] +terminis [--edit|--help|n] ``` -* edit: edit controls in text editor -* help: show command usage +* --edit: edit controls in text editor +* --help: show command usage * n (integer between 1 and 15): start at level n diff --git a/terminis/terminis.py b/terminis/terminis.py index 30206bd..a1515c3 100644 --- a/terminis/terminis.py +++ b/terminis/terminis.py @@ -719,10 +719,10 @@ class Game: def main(): - if "edit" in sys.argv[1:]: + if "--edit" in sys.argv[1:]: edit() - elif "help" in sys.argv[1:]: - usage() + elif "--help" in sys.argv[1:] or "/?" in sys.argv[1:]: + print_help() else: curses.wrapper(Game) @@ -735,11 +735,11 @@ def edit(): else: subprocess.call(["${EDITOR:-vi}", Controls.FILE_PATH]) -def usage(): +def print_help(): print("Usage:") - print("python terminis.py [edit|help|n]") - print(" edit: edit controls in text editor") - print(" help: show command usage (this message)") + print("python terminis.py [--edit|--help|n]") + print(" --edit: edit controls in text editor") + print(" --help: show command usage (this message)") print(" n (integer between 1 and 15): start at level n")