From b0f6e4f4c8e5621a7fc2b262a77b2ba9ae73fb7a Mon Sep 17 00:00:00 2001 From: The Magician Date: Sun, 5 Nov 2023 19:09:42 +0000 Subject: [PATCH] Make quoting consistent --- thebookofcolors | 70 ++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/thebookofcolors b/thebookofcolors index 7bbfc97..8e876e6 100755 --- a/thebookofcolors +++ b/thebookofcolors @@ -3,23 +3,23 @@ set -e thebookofcolors() { - printf '\e[4;7;36m' + printf "\e[4;7;36m" if test -z "$1"; then - printf 'The Book of Colors' + printf "The Book of Colors" else printf "$1" fi - printf '\e[0m' + printf "\e[0m" } newline() { if test -z "$1"; then - printf '\n' + printf "\n" return fi for i in $(seq 1 $1); do - printf '\n' + printf "\n" done } @@ -29,71 +29,71 @@ title() { exit 1 fi - printf '\e[1;4;37m' + printf "\e[1;4;37m" printf "$1" - printf '\e[0m\n' + printf "\e[0m\n" } section_introduction() { title "Introduction" thebookofcolors - printf ' is an in-terminal manual on ANSI escape codes, or "color codes", for use in terminal emulators.\n' - printf 'Examples are given not only in written form, but "practical" form -- every escape code and option described in ' + printf " is an in-terminal manual on ANSI escape codes, or \"color codes\", for use in terminal emulators.\n" + printf "Examples are given not only in written form, but \"practical\" form -- every escape code and option described in " thebookofcolors - printf ' is used in ' + printf " is used in " thebookofcolors "The Book" - printf ' itself.\n' + printf " itself.\n" } section_disclaimers() { title "Disclaimers" thebookofcolors - printf ' is open-source software and is provided as-is with NO WARRANTY under applicable law.\n' - printf 'If any escape codes persist to your terminal session after viewing ' + printf " is open-source software and is provided as-is with NO WARRANTY under applicable law.\n" + printf "If any escape codes persist to your terminal session after viewing " thebookofcolors "The Book" - printf ', use the `reset` command to restore your terminal.\n' - printf 'If you believe you have found a bug, please open an issue on the repository, which can be found at .\n' - printf 'If you have a fix for said bug, please submit a pull request instead.\n' + printf ", use the \`reset\` command to restore your terminal.\n" + printf "If you believe you have found a bug, please open an issue on the repository, which can be found at .\n" + printf "If you have a fix for said bug, please submit a pull request instead.\n" } section_anatomy() { title "Anatomy of an ANSI Escape Code" - printf 'Escape codes begin with `\\e`, `\\033`, or `\\x1b`. These are all three different escape sequences which insert the ASCII character 27, or ESC. (This is why they''re called ANSI "escape" codes, because they begin with a literal escape character). The syntax `\\e` is used throughout ' + printf "Escape codes begin with \`\\e\`, \`\\033\`, or \`\\x1b\`. These are all three different escape sequences which insert the ASCII character 27, or ESC. (This is why they're called ANSI \"escape\" codes, because they begin with a literal escape character). The syntax \`\\e\` is used throughout " thebookofcolors - printf '. The choice is arbitrary, but consistent throughout.\n' - printf 'The next character is a `[`. This combination of characters, an escape followed by an open bracket, is called the "CSI", or "Control Sequence Introducer", which indicates the start of a control code.\n' + printf ". The choice is arbitrary, but consistent throughout.\n" + printf "The next character is a \`[\`. This combination of characters, an escape followed by an open bracket, is called the \"CSI\", or \"Control Sequence Introducer\", which indicates the start of a control code.\n" newline - printf 'Overall, a control sequence is formatted like so:\n' + printf "Overall, a control sequence is formatted like so:\n" newline - printf '\e[3m0x1B + [ + + \e[0m\n' + printf "\e[3m0x1B + [ + + \e[0m\n" newline - printf 'The CSI sequence we''ve gone over already. The easiest way to think about this is that the letter is the name of a function, and the semicolon-delimited numbers are the arguments to said function.\n' - printf 'By this model of thinking about escape sequences like function calls means you would read "\\e[0;1;34m" as m(0, 1, 34), and "\\e[A" as A().\n' + printf "The CSI sequence we've gone over already. The easiest way to think about this is that the letter is the name of a function, and the semicolon-delimited numbers are the arguments to said function.\n" + printf "By this model of thinking about escape sequences like function calls means you would read \"\\e[0;1;34m\" as m(0, 1, 34), and \"\\e[A\" as A().\n" newline - printf 'The "m" function is the one we''re interested in. This is the "SGR", or "Select Graphics Rendition", code, and it tells the terminal to activate color and other text effects, which is what we''re interested in.\n' + printf "The \"m\" function is the one we're interested in. This is the \"SGR\", or \"Select Graphics Rendition\", code, and it tells the terminal to activate color and other text effects, which is what we're interested in.\n" } section_regular_colors() { title "Codes 30-37; Regular Foreground Colors" - printf 'Originally, hardware video terminals only had support for eight standard colors.\n' - printf 'The SGR control codes 30 through 37 are used to set the foreground color to each of these colors.\n' - printf 'These colors and their respective escape codes are shown in the following table:\n' + printf "Originally, hardware video terminals only had support for eight standard colors.\n" + printf "The SGR control codes 30 through 37 are used to set the foreground color to each of these colors.\n" + printf "These colors and their respective escape codes are shown in the following table:\n" newline - printf '\e[30m\\e[30m Black\e[0m\n' - printf '\e[31m\\e[31m Red\e[0m\n' - printf '\e[32m\\e[32m Green\e[0m\n' - printf '\e[33m\\e[33m Brown\e[0m\n' - printf '\e[34m\\e[34m Blue\e[0m\n' - printf '\e[35m\\e[35m Purple\e[0m\n' - printf '\e[36m\\e[36m Cyan\e[0m\n' - printf '\e[37m\\e[37m Light grey\e[0m\n' + printf "\e[30m\\e[30m Black\e[0m\n" + printf "\e[31m\\e[31m Red\e[0m\n" + printf "\e[32m\\e[32m Green\e[0m\n" + printf "\e[33m\\e[33m Brown\e[0m\n" + printf "\e[34m\\e[34m Blue\e[0m\n" + printf "\e[35m\\e[35m Purple\e[0m\n" + printf "\e[36m\\e[36m Cyan\e[0m\n" + printf "\e[37m\\e[37m Light grey\e[0m\n" } section_notes_on_names() {