lower case options, config comment

This commit is contained in:
adrienmalin 2019-02-15 17:25:50 +01:00
parent b4f1ff4bfd
commit 6b66fb7664
2 changed files with 11 additions and 12 deletions

View File

@ -10,7 +10,7 @@ pip install --user terminis
## Usage ## Usage
```bash ```bash
terminis [OPTIONS] terminis [options]
``` ```
* --help: show command usage (this message) * --help: show command usage (this message)
* --edit: edit controls in text editor * --edit: edit controls in text editor

View File

@ -22,7 +22,7 @@ except ImportError:
DIR_NAME = "Terminis" DIR_NAME = "Terminis"
HELP_MSG = """terminis [OPTIONS] HELP_MSG = """terminis [options]
Tetris clone for terminal Tetris clone for terminal
@ -501,6 +501,14 @@ class ControlsParser(configparser.SafeConfigParser):
DIR_PATH = os.path.join(DIR_PATH, DIR_NAME) DIR_PATH = os.path.join(DIR_PATH, DIR_NAME)
FILE_PATH = os.path.join(DIR_PATH, FILE_NAME) FILE_PATH = os.path.join(DIR_PATH, FILE_NAME)
SECTION = "CONTROLS" 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): def __init__(self):
configparser.SafeConfigParser.__init__(self) configparser.SafeConfigParser.__init__(self)
@ -530,16 +538,7 @@ class ControlsParser(configparser.SafeConfigParser):
os.mkdir(self.DIR_PATH) os.mkdir(self.DIR_PATH)
try: try:
with open(self.FILE_PATH, 'w') as f: with open(self.FILE_PATH, 'w') as f:
f.write( f.write(self.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
"""
)
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:")