[pacman-dev] [PATCHv2 03/10] script: add color to pacman-db-upgrade
Allan McRae
allan at archlinux.org
Sun Mar 3 18:07:28 EST 2013
On 04/03/13 04:48, William Giokas wrote:
> Use color by default, -m/--no-color turns off colors.
>
If you are going to follow the really bad single letter option from
makepkg, you should follow the long option name too.
> Signed-off-by: William Giokas <1007380 at gmail.com>
> ---
> scripts/pacman-db-upgrade.sh.in | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in
> index 1b5407a..edd41db 100644
> --- a/scripts/pacman-db-upgrade.sh.in
> +++ b/scripts/pacman-db-upgrade.sh.in
> @@ -28,11 +28,13 @@ declare -r myver='@PACKAGE_VERSION@'
> eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
> dbroot="${DBPath:- at localstatedir@/lib/pacman/}"
>
> +USE_COLOR='y'
> +
> m4_include(library/output_format.sh)
>
> usage() {
> printf "pacman-db-upgrade (pacman) %s\n\n" "$myver"
> - printf -- "$(gettext "Usage: %s [pacman_db_root]")\n\n" "$0"
> + printf -- "$(gettext "Usage: %s [-m|--no-color] [pacman_db_root]")\n\n" "$0"
> }
>
> version() {
> @@ -72,6 +74,13 @@ if [[ $1 = "-V" || $1 = "--version" ]]; then
> exit 0
> fi
>
> +if [[ $1 = "-m" || $1 = "--no-color" ]]; then
> + USE_COLOR='n'
> + shift
> +fi
> +
> +m4_include(library/term_colors.sh)
> +
> if [[ -n $1 ]]; then
> dbroot="$1"
> fi
>
More information about the pacman-dev
mailing list