kjv

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit aab4c098b6662c6781831f9485579f9be37c5d38
parent 5ddd6fc525ba5095e89899c0de4108132ac26e97
Author: Tim Cooper <tim.cooper@layeh.com>
Date:   Sat, 11 Aug 2018 15:51:10 -0300

add -W to disable line wrap

Diffstat:
MREADME.md | 1+
Mkjv.awk | 5+++++
Mkjv.sh | 7++++++-
3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md @@ -7,6 +7,7 @@ Read the Word of God from your terminal usage: ./kjv [flags] <references...> -l list books + -W no line wrap -h show help References types: diff --git a/kjv.awk b/kjv.awk @@ -107,6 +107,11 @@ function parseref(ref, arr) { } function printverse(verse, word_count, characters_printed) { + if (ENVIRON["KJV_NOLINEWRAP"] != "" && ENVIRON["KJV_NOLINEWRAP"] != "0") { + printf("%s\n", verse) + return + } + word_count = split(verse, words, " ") for (i = 1; i <= word_count; i++) { if (characters_printed + length(words[i]) + (characters_printed > 0 ? 1 : 0) > 72) { diff --git a/kjv.sh b/kjv.sh @@ -21,6 +21,7 @@ show_help() { echo "usage: $(basename "$0") [flags] <references...>" echo echo " -l list books" + echo " -W no line wrap" echo " -h show help" echo echo " References types:" @@ -60,10 +61,14 @@ while [ $# -gt 0 ]; do # List all book names with their abbreviations get_data kjv.tsv | awk -v cmd=list "$(get_data kjv.awk)" exit + elif [ "$1" = "-W" ]; then + export KJV_NOLINEWRAP=1 + shift elif [ "$1" = "-h" ] || [ "$isFlag" -eq 1 ]; then show_help + else + break fi - break done if [ $# -eq 0 ]; then