From c888fa53f939a917bdc248ee9f955a3bff9f451c Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 14 May 2023 17:56:03 -0500 Subject: [PATCH] fix(#4): demo takes precedence --- docs/themes.md | 55 -------------------------------------- mkdocs.yml | 3 ++- scripts/theme-showcase-gen | 26 +++++++----------- src/yartsu/cli.py | 16 +++++++---- 4 files changed, 23 insertions(+), 77 deletions(-) delete mode 100644 docs/themes.md diff --git a/docs/themes.md b/docs/themes.md deleted file mode 100644 index e991c20..0000000 --- a/docs/themes.md +++ /dev/null @@ -1,55 +0,0 @@ -
- -# Themes - -Available themes: - -- [cat-mocha](#cat-mocha) -- [cat-macchiato](#cat-macchiato) -- [cat-frappe](#cat-frappe) -- [cat-latte](#cat-latte) -- [dracula](#dracula) -- [gruvbox-dark](#gruvbox-dark) -- [gruvbox-light](#gruvbox-light) -- [nord](#nord) -- [dimmed_monokai](#dimmed/monokai) -- [monokai](#monokai) -- [night-owlish](#night-owlish) -- [rich-default](#rich-default) - -## cat-mocha -![cat-mocha](./themes/cat-mocha.svg) -

(back to top)

-## cat-macchiato -![cat-macchiato](./themes/cat-macchiato.svg) -

(back to top)

-## cat-frappe -![cat-frappe](./themes/cat-frappe.svg) -

(back to top)

-## cat-latte -![cat-latte](./themes/cat-latte.svg) -

(back to top)

-## dracula -![dracula](./themes/dracula.svg) -

(back to top)

-## gruvbox-dark -![gruvbox-dark](./themes/gruvbox-dark.svg) -

(back to top)

-## gruvbox-light -![gruvbox-light](./themes/gruvbox-light.svg) -

(back to top)

-## nord -![nord](./themes/nord.svg) -

(back to top)

-## dimmed_monokai -![dimmed_monokai](./themes/dimmed_monokai.svg) -

(back to top)

-## monokai -![monokai](./themes/monokai.svg) -

(back to top)

-## night-owlish -![night-owlish](./themes/night-owlish.svg) -

(back to top)

-## rich-default -![rich-default](./themes/rich-default.svg) -

(back to top)

diff --git a/mkdocs.yml b/mkdocs.yml index 14d2e54..a9919b5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -31,9 +31,10 @@ plugins: enable_creation_date: true markdown_extensions: - - def_list - pymdownx.highlight: anchor_linenums: true - pymdownx.inlinehilite - pymdownx.snippets - pymdownx.superfences + - pymdownx.tabbed: + alternate_style: true diff --git a/scripts/theme-showcase-gen b/scripts/theme-showcase-gen index b313ce6..fc82a59 100755 --- a/scripts/theme-showcase-gen +++ b/scripts/theme-showcase-gen @@ -4,32 +4,26 @@ THEME_MD="./docs/themes.md" themes=$(yartsu --list-themes | tail -n +5 | cut -d' ' -f 3) -newline() { - echo >>"$THEME_MD" -} - mkdir -p ./docs/themes rm -f ./docs/themes/* rm -f $THEME_MD +yartsu -o docs/themes/list.svg -- yartsu --list-themes -echo '
' >>$THEME_MD -newline -echo "# Themes" >>$THEME_MD -newline +cat >>"$THEME_MD" <>$THEME_MD +

+ +

-for theme in $themes; do - echo "- [$theme](#${theme//_//})" >>$THEME_MD -done -newline +See below for example outputs of each. +EOF for theme in $themes; do url="docs/themes/${theme}.svg" cat >>"$THEME_MD" <(back to top)

+=== "$theme" + ![$theme](./themes/${theme}.svg) EOF yartsu --theme "$theme" -o "$url" --demo -t "yartsu --theme ${theme} --demo" done diff --git a/src/yartsu/cli.py b/src/yartsu/cli.py index b9daaa7..9bc542b 100644 --- a/src/yartsu/cli.py +++ b/src/yartsu/cli.py @@ -106,13 +106,19 @@ def main() -> None: else: cmd = None - if args.input: - parsed_input = Text.from_ansi(args.input.read()) - - elif args.demo: - console = Console(file=io.StringIO(), record=True, force_terminal=True) + if args.demo: + console = Console( + file=io.StringIO(), + record=True, + force_terminal=True, + color_system="truecolor", + legacy_windows=False, + ) parsed_input = make_test_card() # type: ignore + elif args.input: + parsed_input = Text.from_ansi(args.input.read()) + title = args.title or cmd or "yartsu" if args.width: