add no color function

This commit is contained in:
emmett1
2017-07-29 12:49:38 +08:00
parent 756ab95020
commit 5a0264d894
5 changed files with 52 additions and 0 deletions

View File

@@ -435,6 +435,9 @@ parse_options() {
-cc|--check-checksum)
CHECK_CHECKSUM=yes
;;
--no-color)
NO_COLOR=yes
;;
-sd|--source-dir)
if [ ! "$2" ]; then
msg "Option '$1' require an argument (source path for package)."
@@ -475,6 +478,11 @@ main() {
parse_options "$@"
### DISABLE COLOR ###
if [ "$NO_COLOR" ]; then
nocolor
fi
### SET OUTPUT PATH FOR PACKAGE ###
if [ $OUTPUT_PKG ]; then
PACKAGE_DIR="$OUTPUT_PKG"

View File

@@ -60,6 +60,26 @@ rm_silent() {
command rm -d "$@" 2> /dev/null
}
nocolor() {
color_red=''
color_green=''
color_yellow=''
color_blue=''
color_purple=''
color_cyan=''
color_gray=''
color_bred=''
color_bgreen=''
color_byellow=''
color_bblue=''
color_bpurple=''
color_bcyan=''
color_bgray=''
color_reset=''
}
updatesystemdb() {
# update desktop database

View File

@@ -276,6 +276,9 @@ parse_options() {
--no-backup)
NO_BACKUP=yes
;;
--no-color)
NO_COLOR=yes
;;
*.spkg.txz)
[ -f $1 ] && PKGNAME=$1 || msg "${color_red}$1${color_reset} not exist."
;;
@@ -295,6 +298,11 @@ main() {
parse_options "$@"
### DISABLE COLOR ###
if [ "$NO_COLOR" ]; then
nocolor
fi
### LOAD CONFIGURATION FILE ###
if [ -f $CONF_FILE ]; then
. $CONF_FILE

View File

@@ -151,6 +151,9 @@ parse_options() {
--no-postremove)
NO_POSTREMOVE=yes
;;
--no-color)
NO_COLOR=yes
;;
*)
RMNAME=$1
;;
@@ -166,6 +169,11 @@ main() {
parse_options "$@"
### DISABLE COLOR ###
if [ "$NO_COLOR" ]; then
nocolor
fi
### LOAD CONFIGURATION FILE ###
if [ -f $CONF_FILE ]; then
. $CONF_FILE

View File

@@ -362,6 +362,9 @@ parse_options() {
--sync)
SYNC_PORTS=yes
;;
--no-color)
NO_COLOR=yes
;;
-dp|--dependent)
if [ ! "$2" ]; then
info "Option '$1' require an argument (package to show its dependent)"
@@ -441,6 +444,11 @@ main() {
parse_options "$@"
### DISABLE COLOR ###
if [ "$NO_COLOR" ]; then
nocolor
fi
### LOAD CONFIGURATION FILE ###
if [ -f $CONF_FILE ]; then
. $CONF_FILE