script_path="$(readlink -f ${0%/*})"
arch="x86_64"
+repo="alter-stable"
debug=false
force=false
skip=false
+nocolor=false
set -e
esac
done
shift $((OPTIND - 1))
- echo ${echo_opts} "$( echo_color -t '36' "[${script_name}]") $( echo_color -t '32' 'Info') ${*}"
+ if [[ "${nocolor}" = true ]]; then
+ echo ${echo_opts} "[${script_name}] Info ${*}"
+ else
+ echo ${echo_opts} "$( echo_color -t '36' "[${script_name}]") $( echo_color -t '32' 'Info') ${*}"
+ fi
}
esac
done
shift $((OPTIND - 1))
- echo ${echo_opts} "$( echo_color -t '36' "[${script_name}]") $( echo_color -t '33' 'Warning') ${*}" >&2
+ if [[ "${nocolor}" = true ]]; then
+ echo ${echo_opts} "[${script_name}] Warning ${*}"
+ else
+ echo ${echo_opts} "$( echo_color -t '36' "[${script_name}]") $( echo_color -t '33' 'Warning') ${*}" >&2
+ fi
}
done
shift $((OPTIND - 1))
if [[ "${debug}" = true ]]; then
- echo ${echo_opts} "$( echo_color -t '36' "[${script_name}]") $( echo_color -t '35' 'Debug') ${*}"
+ if [[ "${nocolor}" = true ]]; then
+ echo ${echo_opts} "[${script_name}] Debug ${*}"
+ else
+ echo ${echo_opts} "$( echo_color -t '36' "[${script_name}]") $( echo_color -t '35' 'Debug') ${*}"
+ fi
fi
}
esac
done
shift $((OPTIND - 1))
- echo ${echo_opts} "$( echo_color -t '36' "[${script_name}]") $( echo_color -t '31' 'Error') ${1}" >&2
+ if [[ "${nocolor}" = true ]]; then
+ echo ${echo_opts} "[${script_name}] Error ${1}"
+ else
+ echo ${echo_opts} "$( echo_color -t '36' "[${script_name}]") $( echo_color -t '31' 'Error') ${1}" >&2
+ fi
if [[ -n "${2:-}" ]]; then
exit ${2}
fi
fi
_opt_short="h,r:,a:sf"
-_opt_long="help,repo:,arch:,skip,force"
+_opt_long="help,repo:,arch:,skip,force,nocolor"
OPT=$(getopt -o ${_opt_short} -l ${_opt_long} -- "${@}")
if [[ ${?} != 0 ]]; then
skip=true
shift 1
;;
+ --nocolor)
+ nocolor=true
+ shift 1
+ ;;
--)
shift 1
break
if [[ "${force}" = true ]]; then
rm -rf "${script_path}/${repo}/${arch}/${pkg}"
elif [[ -d "${script_path}/${repo}/${arch}/${pkg}" ]]; then
- _msg_error "Hoge has already been added."
+ _msg_error "${pkg} has already been added."
if [[ "${skip}" = true ]]; then
continue
else