ci: fmt/gen
This commit is contained in:
parent
c09064dc60
commit
c74d32fce9
3 changed files with 23 additions and 17 deletions
|
|
@ -55,20 +55,22 @@ tput() {
|
|||
|
||||
should_color() {
|
||||
if [ -n "${COLOR-}" ]; then
|
||||
if [ "${COLOR-}" = 0 -o "${COLOR-}" = false ]; then
|
||||
_COLOR=0
|
||||
if [ "$COLOR" = 0 -o "$COLOR" = false ]; then
|
||||
_COLOR=
|
||||
return 1
|
||||
elif [ "${COLOR-}" = 1 -o "${COLOR-}" = true ]; then
|
||||
elif [ "$COLOR" = 1 -o "$COLOR" = true ]; then
|
||||
_COLOR=1
|
||||
return 0
|
||||
else
|
||||
printf '$COLOR must be 0, 1, false or true but got %s' "$COLOR" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -t 1 ]; then
|
||||
_COLOR=1
|
||||
return 0
|
||||
else
|
||||
_COLOR=
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
|
@ -109,11 +111,12 @@ printfp() {(
|
|||
if [ -z "${FGCOLOR-}" ]; then
|
||||
FGCOLOR="$(get_rand_color "$prefix")"
|
||||
fi
|
||||
setaf "$FGCOLOR" "[$prefix]"
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
printf ' '
|
||||
printf "$@"
|
||||
if [ $# -eq 0 ]; then
|
||||
should_color || true
|
||||
printf '%s' $(COLOR=${_COLOR-} setaf "$FGCOLOR" "$prefix")
|
||||
else
|
||||
should_color || true
|
||||
printf '%s: %s\n' $(COLOR=${_COLOR-} setaf "$FGCOLOR" "$prefix") "$(printf "$@")"
|
||||
fi
|
||||
)}
|
||||
|
||||
|
|
|
|||
2
ci/sub
2
ci/sub
|
|
@ -1 +1 @@
|
|||
Subproject commit c5e5d53caa3241629a56b95eaf9780a68546ad61
|
||||
Subproject commit 2eb7e4fa5e2457a62140ed3e95c1d75f75cb583c
|
||||
19
install.sh
19
install.sh
|
|
@ -61,20 +61,22 @@ tput() {
|
|||
|
||||
should_color() {
|
||||
if [ -n "${COLOR-}" ]; then
|
||||
if [ "${COLOR-}" = 0 -o "${COLOR-}" = false ]; then
|
||||
_COLOR=0
|
||||
if [ "$COLOR" = 0 -o "$COLOR" = false ]; then
|
||||
_COLOR=
|
||||
return 1
|
||||
elif [ "${COLOR-}" = 1 -o "${COLOR-}" = true ]; then
|
||||
elif [ "$COLOR" = 1 -o "$COLOR" = true ]; then
|
||||
_COLOR=1
|
||||
return 0
|
||||
else
|
||||
printf '$COLOR must be 0, 1, false or true but got %s' "$COLOR" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -t 1 ]; then
|
||||
_COLOR=1
|
||||
return 0
|
||||
else
|
||||
_COLOR=
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
|
@ -115,11 +117,12 @@ printfp() {(
|
|||
if [ -z "${FGCOLOR-}" ]; then
|
||||
FGCOLOR="$(get_rand_color "$prefix")"
|
||||
fi
|
||||
setaf "$FGCOLOR" "[$prefix]"
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
printf ' '
|
||||
printf "$@"
|
||||
if [ $# -eq 0 ]; then
|
||||
should_color || true
|
||||
printf '%s' $(COLOR=${_COLOR-} setaf "$FGCOLOR" "$prefix")
|
||||
else
|
||||
should_color || true
|
||||
printf '%s: %s\n' $(COLOR=${_COLOR-} setaf "$FGCOLOR" "$prefix") "$(printf "$@")"
|
||||
fi
|
||||
)}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue