@@ -23,34 +23,34 @@ version_command() {
2323# :command.usage
2424colorly_usage () {
2525 if [[ -n $long_usage ]]; then
26- echo -e " colorly - Sample application that uses the color functions"
26+ printf " colorly - Sample application that uses the color functions\n "
2727 echo
2828 else
29- echo -e " colorly - Sample application that uses the color functions"
29+ printf " colorly - Sample application that uses the color functions\n "
3030 echo
3131 fi
32- echo -e " Usage:"
33- echo -e " colorly [MESSAGE] [options]"
34- echo -e " colorly --help | -h"
35- echo -e " colorly --version"
32+ printf " Usage:\n "
33+ printf " colorly [MESSAGE] [options]\n "
34+ printf " colorly --help | -h\n "
35+ printf " colorly --version\n "
3636 echo
3737
3838 if [[ -n $long_usage ]]; then
39- echo -e " Options:"
39+ printf " Options:\n "
4040 # :command.usage_fixed_flags
4141 echo " --help, -h"
42- echo -e " Show this help"
42+ printf " Show this help\n "
4343 echo
4444 echo " --version"
45- echo -e " Show version number"
45+ printf " Show version number\n "
4646 echo
4747
4848 # :command.usage_args
49- echo -e " Arguments:"
49+ printf " Arguments:\n "
5050
5151 # :argument.usage
5252 echo " MESSAGE"
53- echo -e " Message to show [default: hello colors]"
53+ printf " Message to show [default: hello colors]\n "
5454 echo
5555
5656 fi
@@ -71,31 +71,31 @@ inspect_args() {
7171# Usage:
7272# Use any of the functions below to color or format a portion of a string.
7373#
74- # echo "before $(red this is red) after"
75- # echo "before $(green_bold this is green_bold) after"
74+ # echo "before $(red this is red) after"
75+ # echo "before $(green_bold this is green_bold) after"
7676#
7777# ---
7878
79- red () { echo -e " \e[31m$* \e[0m" ; }
80- green () { echo -e " \e[32m$* \e[0m" ; }
81- yellow () { echo -e " \e[33m$* \e[0m" ; }
82- blue () { echo -e " \e[34m$* \e[0m" ; }
83- magenta () { echo -e " \e[35m$* \e[0m" ; }
84- cyan () { echo -e " \e[36m$* \e[0m" ; }
85- bold () { echo -e " \e[1m$* \e[0m" ; }
86- underlined () { echo -e " \e[4m$* \e[0m" ; }
87- red_bold () { echo -e " \e[1;31m$* \e[0m" ; }
88- green_bold () { echo -e " \e[1;32m$* \e[0m" ; }
89- yellow_bold () { echo -e " \e[1;33m$* \e[0m" ; }
90- blue_bold () { echo -e " \e[1;34m$* \e[0m" ; }
91- magenta_bold () { echo -e " \e[1;35m$* \e[0m" ; }
92- cyan_bold () { echo -e " \e[1;36m$* \e[0m" ; }
93- red_underlined () { echo -e " \e[4;31m$* \e[0m" ; }
94- green_underlined () { echo -e " \e[4;32m$* \e[0m" ; }
95- yellow_underlined () { echo -e " \e[4;33m$* \e[0m" ; }
96- blue_underlined () { echo -e " \e[4;34m$* \e[0m" ; }
97- magenta_underlined () { echo -e " \e[4;35m$* \e[0m" ; }
98- cyan_underlined () { echo -e " \e[4;36m$* \e[0m" ; }
79+ red () { printf " \e[31m%b \e[0m\n " " $* " ; }
80+ green () { printf " \e[32m%b \e[0m\n " " $* " ; }
81+ yellow () { printf " \e[33m%b \e[0m\n " " $* " ; }
82+ blue () { printf " \e[34m%b \e[0m\n " " $* " ; }
83+ magenta () { printf " \e[35m%b \e[0m\n " " $* " ; }
84+ cyan () { printf " \e[36m%b \e[0m\n " " $* " ; }
85+ bold () { printf " \e[1m%b \e[0m\n " " $* " ; }
86+ underlined () { printf " \e[4m%b \e[0m\n " " $* " ; }
87+ red_bold () { printf " \e[1;31m%b \e[0m\n " " $* " ; }
88+ green_bold () { printf " \e[1;32m%b \e[0m\n " " $* " ; }
89+ yellow_bold () { printf " \e[1;33m%b \e[0m\n " " $* " ; }
90+ blue_bold () { printf " \e[1;34m%b \e[0m\n " " $* " ; }
91+ magenta_bold () { printf " \e[1;35m%b \e[0m\n " " $* " ; }
92+ cyan_bold () { printf " \e[1;36m%b \e[0m\n " " $* " ; }
93+ red_underlined () { printf " \e[4;31m%b \e[0m\n " " $* " ; }
94+ green_underlined () { printf " \e[4;32m%b \e[0m\n " " $* " ; }
95+ yellow_underlined () { printf " \e[4;33m%b \e[0m\n " " $* " ; }
96+ blue_underlined () { printf " \e[4;34m%b \e[0m\n " " $* " ; }
97+ magenta_underlined () { printf " \e[4;35m%b \e[0m\n " " $* " ; }
98+ cyan_underlined () { printf " \e[4;36m%b \e[0m\n " " $* " ; }
9999
100100# :command.command_functions
101101
@@ -127,7 +127,7 @@ parse_requirements() {
127127 case " $key " in
128128
129129 -* )
130- echo -e " invalid option: $key "
130+ printf " invalid option: %s\n " " $key "
131131 exit 1
132132 ;;
133133
@@ -137,7 +137,7 @@ parse_requirements() {
137137 args[message]=$1
138138 shift
139139 else
140- echo -e " invalid argument: $key "
140+ printf " invalid argument: %s\n " " $key "
141141 exit 1
142142 fi
143143 ;;
0 commit comments