From 6b66fb7664e42b7a78a3ab404b19c9e9062fa292 Mon Sep 17 00:00:00 2001 From: adrienmalin <41926238+adrienmalin@users.noreply.github.com> Date: Fri, 15 Feb 2019 17:25:50 +0100 Subject: [PATCH] lower case options, config comment --- README.md | 2 +- terminis/terminis.py | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0fa58e0..58007f2 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pip install --user terminis ## Usage ```bash -terminis [OPTIONS] +terminis [options] ``` * --help: show command usage (this message) * --edit: edit controls in text editor diff --git a/terminis/terminis.py b/terminis/terminis.py index 1666cb3..4889b19 100644 --- a/terminis/terminis.py +++ b/terminis/terminis.py @@ -22,7 +22,7 @@ except ImportError: DIR_NAME = "Terminis" -HELP_MSG = """terminis [OPTIONS] +HELP_MSG = """terminis [options] Tetris clone for terminal @@ -501,6 +501,14 @@ class ControlsParser(configparser.SafeConfigParser): DIR_PATH = os.path.join(DIR_PATH, DIR_NAME) FILE_PATH = os.path.join(DIR_PATH, FILE_NAME) SECTION = "CONTROLS" + COMMENT = """# You can change key below. +# Acceptable values are: +# `SPACE`, `TAB`, `ENTER`, +# printable characters (`q`, `*`...), +# curses's constants name starting with `KEY_` +# See https://docs.python.org/3/library/curses.html?highlight=curses#constants + +""" def __init__(self): configparser.SafeConfigParser.__init__(self) @@ -530,16 +538,7 @@ class ControlsParser(configparser.SafeConfigParser): os.mkdir(self.DIR_PATH) try: with open(self.FILE_PATH, 'w') as f: - f.write( -"""# You can change key below. -# Acceptable values are: -# `SPACE`, `TAB`, `ENTER` -# printable characters (`q`, `*`...) -# curses's constants name starting with `KEY_` -# See https://docs.python.org/3/library/curses.html?highlight=curses#constants - -""" - ) + f.write(self.COMMENT) self.write(f) except Exception as e: print("Configuration could not be saved:")