From 18d848aaf63e169f92602686cd59ad17c0b3c6de Mon Sep 17 00:00:00 2001 From: Pooya Moradi Date: Sun, 15 May 2022 13:01:53 +0430 Subject: [PATCH] Add newline to log HELP for increased readability Add disclaimer about using bat to README --- README.md | 2 +- xdg-ninja.sh | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d5cdc9a..d97b7e8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ This will run every test in the default configuration. ### Optional -- [glow](https://repology.org/project/glow/packages) or [bat](https://repology.org/project/bat-cat/packages) for rendering markdown in the terminal +- [glow](https://repology.org/project/glow/packages) for rendering markdown in the terminal ([bat](https://repology.org/project/bat-cat/packages) can be used as a fallback, but glows output is clearer and therefore recommended) - [cabal](https://repology.org/project/cabal/packages) for compiling the helper program for creating configurations ## Configuration diff --git a/xdg-ninja.sh b/xdg-ninja.sh index c7b4ab2..d873df2 100755 --- a/xdg-ninja.sh +++ b/xdg-ninja.sh @@ -7,10 +7,12 @@ if command -v glow >/dev/null 2>/dev/null; then USE_GLOW=true elif command -v bat >/dev/null 2>/dev/null; then USE_BAT=true + printf "Glow not found, markdown rendering will be done by bat.\n" + printf "Install glow for easier reading & copy-paste.\n" else printf "Glow or bat not found, markdown rendering not available.\n" printf "Output will be raw markdown and might look weird.\n" - printf "Install glow or bat for easier reading & copy-paste.\n" + printf "Install glow for easier reading & copy-paste.\n" fi unalias -a @@ -126,11 +128,11 @@ log() { HELP) if $USE_GLOW; then - printf "%s" "$HELP" | glow - + printf "%s\n" "$HELP" | glow - elif $USE_BAT; then - printf "%s" "$HELP" | bat -pp -f --language markdown + printf "%s\n" "$HELP" | bat -pp -f --language markdown else - printf "%s" "$HELP" + printf "%s\n" "$HELP" fi ;; -- 2.47.3