autospec, autospec.conf, plugins: replace the option '--colorize' by '--colors <color-theme>'
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
parent
ac3e9bc14b
commit
a2056ba9d5
@ -41,6 +41,10 @@ Changes in version 1.14.2
|
||||
* configuration - Davide Madrisan:
|
||||
Add 'color-theme.none'. This theme can be used to disable color themes.
|
||||
|
||||
+ update
|
||||
* autospec, autospec.conf, plugins/* - Davide Madrisan:
|
||||
Replace the option '--colorize' by '--colors <color-theme>'.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Changes in version 1.14.1 - _TO*Hacklab release
|
||||
|
24
autospec.in
24
autospec.in
@ -62,8 +62,7 @@ function autospec.usage() {
|
||||
-h, --help "$"Print this help, then exit""
|
||||
-V, --version "$"Print version number, then exit""
|
||||
-q, --quiet "$"Run in quiet mode""
|
||||
-r, --colorize "$"Enable the colorized output""
|
||||
--colorize-theme "$"Select the theme to be used for the colorized output""
|
||||
--colors "$"Select the theme to be used for the colorized output""
|
||||
-D, --debug "$"Run in debugging mode (very verbose output)""
|
||||
|
||||
"$"Usage"":
|
||||
@ -91,6 +90,8 @@ notify.disable_colors
|
||||
{ echo "$me: "$"library not found"": @libdir@/libcfg.lib" 1>&2
|
||||
exit 1; }
|
||||
|
||||
. @libdir@/libcfg.lib
|
||||
|
||||
# Little helper function for reading args from the commandline.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
@ -127,12 +128,12 @@ while (($# > 0)); do
|
||||
-q|--quiet)
|
||||
let "verbose = 0" ;;
|
||||
-r|--colorize)
|
||||
let "colorize = 1"
|
||||
notify.warning $"\
|
||||
deprecated option"" (-r|--colorize), "$"use \`--colorize-theme' instead" ;;
|
||||
--colorize-theme)
|
||||
read_arg colorize_theme "$@" || shift
|
||||
let "colorize = 1" ;;
|
||||
deprecated option"" \`-r|--colorize': "$"use \`--colors' instead"
|
||||
# for backward compatibility
|
||||
color_scheme="default" ;;
|
||||
--colors)
|
||||
read_arg color_scheme "$@" || shift ;;
|
||||
-h|--help)
|
||||
let "print_help = 1" ;;
|
||||
-V|--version)
|
||||
@ -143,7 +144,7 @@ deprecated option"" (-r|--colorize), "$"use \`--colorize-theme' instead" ;;
|
||||
done
|
||||
|
||||
notify.debug "[${me[0]}, "$"version"" ${me[1]}]"
|
||||
notify.debug "colorize_theme = \"$colorize_theme\""
|
||||
notify.debug "color_scheme = \"$color_scheme\""
|
||||
|
||||
case "$(( $pck_update + $spec_create + $pck_extract + $config_getvar ))" in
|
||||
0) [ "$print_help" = "1" ] && autospec.usage 0
|
||||
@ -159,11 +160,8 @@ case "$(( $pck_update + $spec_create + $pck_extract + $config_getvar ))" in
|
||||
*) autospec.usage 1 ;;
|
||||
esac
|
||||
|
||||
. @libdir@/libcfg.lib
|
||||
|
||||
[ "$logging" = "1" ] && let "colorize = 0"
|
||||
[ "$colorize" = "1" ] && notify.enable_colors "$colorize_theme" \
|
||||
|| notify.disable_colors
|
||||
[ "$logging" = "1" ] && color_scheme="none"
|
||||
notify.enable_colors "$color_scheme"
|
||||
|
||||
# checking for errors in the configuration file
|
||||
[ "$config_getvar" = 1 ] || config.integrity
|
||||
|
@ -39,8 +39,9 @@ pck_confs := autospec.conf \
|
||||
|
||||
pck_confs_infiles := $(wildcard *.in)
|
||||
|
||||
pck_color_themes := color-theme.terminal-dark \
|
||||
color-theme.terminal-white color-theme.web color-theme.none
|
||||
pck_color_themes := color-theme.default \
|
||||
color-theme.terminal-dark color-theme.terminal-white color-theme.web \
|
||||
color-theme.none
|
||||
|
||||
all:
|
||||
|
||||
|
@ -43,7 +43,7 @@ spec_backup_attr="hidden"
|
||||
# EXIT="${ESC}[1;31m"
|
||||
# NORM=$(echo -en "${ESC}[m\017")
|
||||
# See the files: see /etc/@package@.d/color-theme.*
|
||||
colorize=1
|
||||
color_scheme="default"
|
||||
|
||||
## Logging directory (default is /var/tmp/@package@) --------------------------
|
||||
logging_dir="/var/tmp/@package@"
|
||||
|
9
conf/color-theme.default
Normal file
9
conf/color-theme.default
Normal file
@ -0,0 +1,9 @@
|
||||
#
|
||||
# color scheme "terminal-dark"
|
||||
#
|
||||
ESC=$(echo -en "\033") # ascii ESCape
|
||||
CRIT="${ESC}[1;31m" # switch on red
|
||||
NOTE="${ESC}[1;33m" # switch on yellow
|
||||
WARN="${ESC}[1;31m"
|
||||
EXIT="${ESC}[1;31m"
|
||||
NORM=$(echo -en "${ESC}[m\017")
|
@ -50,15 +50,14 @@ function notify.note() {
|
||||
# args:
|
||||
# none
|
||||
function notify.enable_colors() {
|
||||
local colorize_theme="$1"
|
||||
# for backward compatibility
|
||||
[ "$colorize_theme" ] || colorize_theme="terminal-dark"
|
||||
|
||||
if [ -r /etc/@package@.d/color-theme.${colorize_theme} ]; then
|
||||
. /etc/@package@.d/color-theme.${colorize_theme}
|
||||
local color_scheme="$1"
|
||||
[ "$color_scheme" ] || color_scheme="default"
|
||||
if [ -r /etc/@package@.d/color-theme.${color_scheme} ]; then
|
||||
. /etc/@package@.d/color-theme.${color_scheme}
|
||||
notify.debug "loading /etc/@package@.d/color-theme.${color_scheme}"
|
||||
else
|
||||
notify.warning \
|
||||
$"unknown color theme \`$colorize_theme': colors will be disabled"
|
||||
$"unknown color theme \`$color_scheme': colors will be disabled"
|
||||
ESC= CRIT= NOTE= WARN= EXIT= NORM=
|
||||
fi
|
||||
}
|
||||
|
@ -13,8 +13,6 @@ me=(${0##*/} "@version@" "@date@")
|
||||
. @libdir@/libmsgmng.lib
|
||||
|
||||
# default values:
|
||||
# - colorized output (disabled by default)
|
||||
let "colorize = 0"
|
||||
# - output verbosity
|
||||
let "verbose = 1"
|
||||
|
||||
@ -63,8 +61,7 @@ function usage() {
|
||||
-h, --help "$"Print this help, then exit""
|
||||
-V, --version "$"Print version number, then exit""
|
||||
-q, --quiet "$"Run in quiet mode""
|
||||
-r, --colorize "$"Enable the colorized output""
|
||||
--colorize-theme "$"Select the theme to be used for the colorized output""
|
||||
--colors "$"Select the theme to be used for the colorized output""
|
||||
-D, --debug "$"Run in debugging mode (very verbose output)""
|
||||
|
||||
"$"Samples"":
|
||||
@ -97,7 +94,7 @@ done
|
||||
exec_options=`LC_ALL=C getopt \
|
||||
-o C:DqrhV \
|
||||
--long eval:,config:,\
|
||||
debug,quiet,colorize,colorize-theme:,help,version,\
|
||||
debug,quiet,colors:,help,version,\
|
||||
frontend_opts: \
|
||||
-n "$me" -- "$@"`
|
||||
[ $? = 0 ] || exit 1
|
||||
@ -115,11 +112,8 @@ while :; do
|
||||
let "verbose = 2" ;;
|
||||
-q|--quiet)
|
||||
let "verbose = 0" ;;
|
||||
-r|--colorize)
|
||||
let "colorize = 1" ;;
|
||||
--colorize-theme)
|
||||
colorize_theme="$2"; shift
|
||||
let "colorize = 1" ;;
|
||||
--colors)
|
||||
color_scheme="$2"; shift ;;
|
||||
-h|--help)
|
||||
usage 0 ;;
|
||||
-V|--version)
|
||||
@ -135,8 +129,7 @@ for arg in $@; do
|
||||
notify.error $"unrecognized option"" -- \`$arg'"
|
||||
done
|
||||
|
||||
[ "$colorize" = "1" ] && notify.enable_colors "$colorize_theme" \
|
||||
|| notify.disable_colors
|
||||
notify.enable_colors "$color_scheme"
|
||||
|
||||
# config.getvar()
|
||||
# Parameters:
|
||||
|
@ -13,8 +13,6 @@ me=(${0##*/} "@version@" "@date@")
|
||||
. @libdir@/libmsgmng.lib
|
||||
|
||||
# default values:
|
||||
# - colorized output (disabled by default)
|
||||
let "colorize = 0"
|
||||
# - output verbosity
|
||||
let "verbose = 1"
|
||||
|
||||
@ -67,8 +65,7 @@ function usage() {
|
||||
-h, --help "$"Print this help, then exit""
|
||||
-V, --version "$"Print version number, then exit""
|
||||
-q, --quiet "$"Run in quiet mode""
|
||||
-r, --colorize "$"Enable the colorized output""
|
||||
--colorize-theme "$"Select the theme to be used for the colorized output""
|
||||
--colors "$"Select the theme to be used for the colorized output""
|
||||
-D, --debug "$"Run in debugging mode (very verbose output)""
|
||||
|
||||
"$"Samples"":
|
||||
@ -102,7 +99,7 @@ exec_options=`LC_ALL=C getopt \
|
||||
-o xF:DqrhV \
|
||||
--long \
|
||||
extract,files:,destdir:,\
|
||||
debug,quiet,colorize,colorize-theme:,help,version,\
|
||||
debug,quiet,colors:,help,version,\
|
||||
frontend_opts: \
|
||||
-n "$me" -- "$@"`
|
||||
[ $? = 0 ] || exit 1
|
||||
@ -121,11 +118,8 @@ while :; do
|
||||
let "verbose = 2" ;;
|
||||
-q|--quiet)
|
||||
let "verbose = 0" ;;
|
||||
-r|--colorize)
|
||||
let "colorize = 1" ;;
|
||||
--colorize-theme)
|
||||
colorize_theme="$2"; shift
|
||||
let "colorize = 1" ;;
|
||||
--colors)
|
||||
color_scheme="$2"; shift ;;
|
||||
-h|--help)
|
||||
usage 0 ;;
|
||||
-V|--version)
|
||||
@ -141,8 +135,7 @@ for arg in $@; do
|
||||
notify.error $"unrecognized option"" -- \`$arg'"
|
||||
done
|
||||
|
||||
[ "$colorize" = "1" ] && notify.enable_colors "$colorize_theme" \
|
||||
|| notify.disable_colors
|
||||
notify.enable_colors "$color_scheme"
|
||||
|
||||
# s_rpm_pck : the name of the srpm package (local or remote)
|
||||
# (i.e. /usr/src/RPM/SRPMS/automake-1.9-1qilnx.src.rpm)
|
||||
|
@ -31,8 +31,6 @@ me=(${0##*/} "@version@" "@date@")
|
||||
. @libdir@/libapse.lib
|
||||
|
||||
# default values:
|
||||
# colorized output (disabled by default)
|
||||
let "colorize = 0"
|
||||
# output verbosity
|
||||
let "verbose = 1"
|
||||
#
|
||||
@ -153,8 +151,7 @@ function usage() {
|
||||
-h, --help "$"Print this help, then exit""
|
||||
-V, --version "$"Print version number, then exit""
|
||||
-q, --quiet "$"Run in quiet mode""
|
||||
-r, --colorize "$"Enable the colorized output""
|
||||
--colorize-theme "$"Select the theme to be used for the colorized output""
|
||||
--colors "$"Select the theme to be used for the colorized output""
|
||||
-D, --debug "$"Run in debugging mode (very verbose output)""
|
||||
|
||||
"$"Samples"":
|
||||
@ -197,7 +194,7 @@ server-download:,server-upload:,server:,\
|
||||
changelog:,nosrpm,norpm,list-check,update-autobuildreq,\
|
||||
force-update,force-build,force-install,force-download,force,\
|
||||
ignore-test:,clear,format,log,rebuild,root:,\
|
||||
debug,quiet,colorize,colorize-theme:,help,version,\
|
||||
debug,quiet,colors:,help,version,\
|
||||
frontend_opts: \
|
||||
-n "$me" -- "$@"`
|
||||
[ $? = 0 ] || exit 1
|
||||
@ -277,11 +274,8 @@ while :; do
|
||||
let "verbose = 2" ;;
|
||||
-q|--quiet)
|
||||
let "verbose = 0" ;;
|
||||
-r|--colorize)
|
||||
let "colorize = 1" ;;
|
||||
--colorize-theme)
|
||||
colorize_theme="$2"; shift
|
||||
let "colorize = 1" ;;
|
||||
--colors)
|
||||
color_scheme="$2"; shift ;;
|
||||
-h|--help)
|
||||
usage 0 ;;
|
||||
-V|--version)
|
||||
@ -312,10 +306,8 @@ if [ -n "$rpm_rootdir" ]; then
|
||||
notify.error $"no such file or directory"": $rpm_rootdir"
|
||||
fi
|
||||
|
||||
[ "$logging" = "1" ] && let "colorize = 0"
|
||||
|
||||
[ "$colorize" = "1" ] && notify.enable_colors "$colorize_theme" \
|
||||
|| notify.disable_colors
|
||||
[ "$logging" = "1" ] && color_scheme="none"
|
||||
notify.enable_colors "$color_scheme"
|
||||
|
||||
# default values for non mandatory configuration variables
|
||||
[ "$logging_dir" ] || logging_dir="${tmppath_dir:-/var/tmp}/@package@"
|
||||
|
@ -18,8 +18,6 @@ me=(${0##*/} "@version@" "@date@")
|
||||
. @libdir@/libnetwork.lib
|
||||
|
||||
# set default variables
|
||||
# colorized output (disabled by default)
|
||||
let "colorize = 0"
|
||||
# output verbosity
|
||||
let "verbose = 1"
|
||||
|
||||
@ -120,8 +118,7 @@ function usage() {
|
||||
-h, --help "$"Print this help, then exit""
|
||||
-V, --version "$"Print version number, then exit""
|
||||
-q, --quiet "$"Run in quiet mode""
|
||||
-r, --colorize "$"Enable the colorized output""
|
||||
--colorize-theme "$"Select the theme to be used for the colorized output""
|
||||
--colors "$"Select the theme to be used for the colorized output""
|
||||
-D, --debug "$"Run in debugging mode (very verbose output)""
|
||||
|
||||
"$"Samples"":
|
||||
@ -163,7 +160,7 @@ exec_options=`LC_ALL=C getopt \
|
||||
--long \
|
||||
source:,pck-name:,pck-version:,type:,output:,changelog:,\
|
||||
git-branch:,preserve-dot-git,\
|
||||
debug,quiet,colorize,colorize-theme:,help,version,\
|
||||
debug,quiet,colors:,help,version,\
|
||||
frontend_opts: \
|
||||
-n "$me" -- "$@"`
|
||||
[ $? = 0 ] || exit 1
|
||||
@ -196,11 +193,8 @@ while :; do
|
||||
let "verbose = 2" ;;
|
||||
-q|--quiet)
|
||||
let "verbose = 0" ;;
|
||||
-r|--colorize)
|
||||
let "colorize = 1" ;;
|
||||
--colorize-theme)
|
||||
colorize_theme="$2"; shift
|
||||
let "colorize = 1" ;;
|
||||
--colors)
|
||||
color_scheme="$2"; shift ;;
|
||||
-h|--help)
|
||||
usage 0 ;;
|
||||
-V|--version)
|
||||
@ -211,8 +205,7 @@ while :; do
|
||||
shift
|
||||
done
|
||||
|
||||
[ "$colorize" = "1" ] && notify.enable_colors "$colorize_theme" \
|
||||
|| notify.disable_colors
|
||||
notify.enable_colors "$color_scheme"
|
||||
|
||||
for arg in $@; do
|
||||
notify.error $"unrecognized option"" -- \`$arg'"
|
||||
|
@ -55,9 +55,6 @@ msgstr "Stampa il numero di versione e termina il programma"
|
||||
msgid "Run in quiet mode"
|
||||
msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione"
|
||||
|
||||
msgid "Enable the colorized output"
|
||||
msgstr "Abilita l'output colorato"
|
||||
|
||||
msgid "Select the theme to be used for the colorized output"
|
||||
msgstr "Seleziona il tema da usare per generare l'output colorato"
|
||||
|
||||
@ -79,8 +76,8 @@ msgstr "libreria non trovata"
|
||||
msgid "deprecated option"
|
||||
msgstr "opzione deprecata"
|
||||
|
||||
msgid "use \\`--colorize-theme' instead"
|
||||
msgstr "utilizzare invece \\`--colorize-theme'"
|
||||
msgid "use \\`--colors' instead"
|
||||
msgstr "utilizzare \\`--colors'"
|
||||
|
||||
msgid "version"
|
||||
msgstr "versione"
|
||||
|
@ -66,9 +66,6 @@ msgstr "Stampa il numero di versione e termina il programma"
|
||||
msgid "Run in quiet mode"
|
||||
msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione"
|
||||
|
||||
msgid "Enable the colorized output"
|
||||
msgstr "Abilita l'output colorato"
|
||||
|
||||
msgid "Select the theme to be used for the colorized output"
|
||||
msgstr "Seleziona il tema da usare per generare l'output colorato"
|
||||
|
||||
|
@ -22,5 +22,6 @@ msgstr "questo script richiede bash versione 2 o superiore"
|
||||
msgid "no message"
|
||||
msgstr "nessun messaggio"
|
||||
|
||||
msgid "unknown color theme \\`$colorize_theme': colors will be disabled"
|
||||
msgstr "tema di colori sconosciuto \\`$colorize_theme': output con colori disabilitato"
|
||||
msgid "unknown color theme \\`$color_scheme': colors will be disabled"
|
||||
msgstr "tema di colori sconosciuto \\`$color_scheme': output con colori disabilitato"
|
||||
|
||||
|
@ -63,9 +63,6 @@ msgstr "Stampa il numero di versione e termina il programma"
|
||||
msgid "Run in quiet mode"
|
||||
msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione"
|
||||
|
||||
msgid "Enable the colorized output"
|
||||
msgstr "Abilita l'output colorato"
|
||||
|
||||
msgid "Select the theme to be used for the colorized output"
|
||||
msgstr "Seleziona il tema da usare per generare l'output colorato"
|
||||
|
||||
|
@ -180,9 +180,6 @@ msgstr "Stampa il numero di versione e termina il programma"
|
||||
msgid "Run in quiet mode"
|
||||
msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione"
|
||||
|
||||
msgid "Enable the colorized output"
|
||||
msgstr "Abilita l'output colorato"
|
||||
|
||||
msgid "Select the theme to be used for the colorized output"
|
||||
msgstr "Seleziona il tema da usare per generare l'output colorato"
|
||||
|
||||
|
@ -100,9 +100,6 @@ msgstr "Stampa il numero di versione e termina il programma"
|
||||
msgid "Run in quiet mode"
|
||||
msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione"
|
||||
|
||||
msgid "Enable the colorized output"
|
||||
msgstr "Abilita l'output colorato"
|
||||
|
||||
msgid "Select the theme to be used for the colorized output"
|
||||
msgstr "Seleziona il tema da usare per generare l'output colorato"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user