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 <[email protected]>
> ---
>  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:-@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
> 


Reply via email to