mirror of
https://github.com/1j01/textual-paint.git
synced 2024-08-17 03:40:26 +03:00
Use choices
option for expressing --theme
This commit is contained in:
parent
6a943389be
commit
87f8faf956
14
README.md
14
README.md
@ -65,19 +65,19 @@ textual-paint
|
||||
|
||||
```
|
||||
$ python3 paint.py --help
|
||||
usage: paint.py [-h] [--theme THEME] [--ascii-only-icons] [--inspect-layout] [--clear-screen] [filename]
|
||||
usage: paint.py [-h] [--theme {light,dark}] [--ascii-only-icons] [--inspect-layout] [--clear-screen] [filename]
|
||||
|
||||
Paint in the terminal.
|
||||
|
||||
positional arguments:
|
||||
filename File to open
|
||||
filename File to open
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--theme THEME Theme to use, either "light" or "dark"
|
||||
--ascii-only-icons Use only ASCII characters for tool icons
|
||||
--inspect-layout Inspect the layout with middle click, for development
|
||||
--clear-screen Clear the screen before starting; useful for development, to avoid seeing fixed errors
|
||||
-h, --help show this help message and exit
|
||||
--theme {light,dark} Theme to use, either "light" or "dark"
|
||||
--ascii-only-icons Use only ASCII characters for tool icons
|
||||
--inspect-layout Inspect the layout with middle click, for development
|
||||
--clear-screen Clear the screen before starting; useful for development, to avoid seeing fixed errors
|
||||
```
|
||||
|
||||
### Keyboard Shortcuts
|
||||
|
6
paint.py
6
paint.py
@ -1318,7 +1318,7 @@ app = PaintApp()
|
||||
# Command line arguments
|
||||
# Please keep in sync with the README
|
||||
parser = argparse.ArgumentParser(description='Paint in the terminal.')
|
||||
parser.add_argument('--theme', default='light', help='Theme to use, either "light" or "dark"')
|
||||
parser.add_argument('--theme', default='light', help='Theme to use, either "light" or "dark"', choices=['light', 'dark'])
|
||||
parser.add_argument('--ascii-only-icons', action='store_true', help='Use only ASCII characters for tool icons')
|
||||
parser.add_argument('--inspect-layout', action='store_true', help='Inspect the layout with middle click, for development')
|
||||
# This flag is for development, because it's very confusing
|
||||
@ -1353,9 +1353,7 @@ if args.filename:
|
||||
app.filename = os.path.abspath(args.filename)
|
||||
if args.clear_screen:
|
||||
os.system("cls||clear")
|
||||
if args.theme not in ["light", "dark"]:
|
||||
print("Invalid theme. Must be either 'light' or 'dark'.")
|
||||
sys.exit(1)
|
||||
|
||||
app.dark = args.theme == "dark"
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user