File tree Expand file tree Collapse file tree 1 file changed +16
-44
lines changed
Expand file tree Collapse file tree 1 file changed +16
-44
lines changed Original file line number Diff line number Diff line change @@ -66,61 +66,33 @@ _help() {
6666# text [-b/-c color/-f/-l/]
6767# -b: 太字, -f: 点滅, -l: 下線
6868text () {
69- local OPTIND OPTARG _arg _textcolor _decotypes=" " _message
69+ local OPTIND OPTARG _arg _textcolor _decotypes=" "
7070 while getopts " c:bfln" _arg; do
7171 case " ${_arg} " in
7272 c)
7373 case " ${OPTARG} " in
74- " black" )
75- _textcolor=" 30"
76- ;;
77- " red" )
78- _textcolor=" 31"
79- ;;
80- " green" )
81- _textcolor=" 32"
82- ;;
83- " yellow" )
84- _textcolor=" 33"
85- ;;
86- " blue" )
87- _textcolor=" 34"
88- ;;
89- " magenta" )
90- _textcolor=" 35"
91- ;;
92- " cyan" )
93- _textcolor=" 36"
94- ;;
95- " white" )
96- _textcolor=" 37"
97- ;;
98- * )
99- return 1
100- ;;
74+ " black" ) _textcolor=" 30" ;;
75+ " red" ) _textcolor=" 31" ;;
76+ " green" ) _textcolor=" 32" ;;
77+ " yellow" ) _textcolor=" 33" ;;
78+ " blue" ) _textcolor=" 34" ;;
79+ " magenta" ) _textcolor=" 35" ;;
80+ " cyan" ) _textcolor=" 36" ;;
81+ " white" ) _textcolor=" 37" ;;
82+ * ) return 1 ;;
10183 esac
10284 ;;
103- b)
104- _decotypes=" ${_decotypes} ;1"
105- ;;
106- f)
107- _decotypes=" ${_decotypes} ;5"
108- ;;
109- l)
110- _decotypes=" ${_decotypes} ;4"
111- ;;
112- n)
113- _decotypes=" ${_decotypes} ;0"
114- ;;
85+ b) _decotypes=" ${_decotypes} ;1" ;;
86+ f) _decotypes=" ${_decotypes} ;5" ;;
87+ l) _decotypes=" ${_decotypes} ;4" ;;
88+ n) _decotypes=" ${_decotypes} ;0" ;;
11589 esac
11690 done
11791 shift " $(( OPTIND - 1 )) "
118-
119- _message=" ${@ } "
12092 if [[ " ${nocolor} " = true ]]; then
121- echo -ne " ${@ } "
93+ echo -ne " ${* } "
12294 else
123- echo -ne " \e[$( [[ -v _textcolor ]] && echo -n " ;${_textcolor} " ; [[ -v _decotypes ]] && echo -n " ${_decotypes} " ) m${_message } \e[m"
95+ echo -ne " \e[$( [[ -v _textcolor ]] && echo -n " ;${_textcolor} " ; [[ -v _decotypes ]] && echo -n " ${_decotypes} " ) m${* } \e[m"
12496 fi
12597}
12698
You can’t perform that action at this time.
0 commit comments