mirror of
https://github.com/daylinmorgan/yartsu.git
synced 2024-12-22 04:20:44 -06:00
refactor: show full help without any input
This commit is contained in:
parent
421a31163a
commit
b248e999d8
1 changed files with 7 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from argparse import SUPPRESS, FileType, Namespace
|
from argparse import SUPPRESS, FileType
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from rich.__main__ import make_test_card
|
from rich.__main__ import make_test_card
|
||||||
|
@ -18,7 +18,7 @@ from .themes import THEMES
|
||||||
DEFAULT_THEME = os.getenv("YARTSU_THEME", "cat-mocha")
|
DEFAULT_THEME = os.getenv("YARTSU_THEME", "cat-mocha")
|
||||||
|
|
||||||
|
|
||||||
def get_args() -> Namespace:
|
def get_parser() -> ArgumentParser:
|
||||||
|
|
||||||
parser = ArgumentParser(
|
parser = ArgumentParser(
|
||||||
usage=SUPPRESS,
|
usage=SUPPRESS,
|
||||||
|
@ -67,11 +67,12 @@ def get_args() -> Namespace:
|
||||||
"--list-themes", help="list available themes", action="store_true"
|
"--list-themes", help="list available themes", action="store_true"
|
||||||
)
|
)
|
||||||
parser.add_argument("--demo", help=SUPPRESS, action="store_true")
|
parser.add_argument("--demo", help=SUPPRESS, action="store_true")
|
||||||
return parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
args = get_args()
|
parser = get_parser()
|
||||||
|
args = parser.parse_args()
|
||||||
console = Console(record=True)
|
console = Console(record=True)
|
||||||
|
|
||||||
if args.list_themes:
|
if args.list_themes:
|
||||||
|
@ -85,7 +86,8 @@ def main() -> None:
|
||||||
"OR pipe terminal output to yartsu",
|
"OR pipe terminal output to yartsu",
|
||||||
err=True,
|
err=True,
|
||||||
)
|
)
|
||||||
term.print("See 'yartsu --help' for more information", err=True)
|
term.print("See below for more information:\n")
|
||||||
|
parser.print_help()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args.theme not in THEMES:
|
if args.theme not in THEMES:
|
||||||
|
|
Loading…
Reference in a new issue