summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Giokas <1007380@gmail.com>2013-03-04 02:23:31 -0600
committerAllan McRae <allan@archlinux.org>2013-03-08 17:04:39 +1000
commit9d99914a1893566ffdfcb53ecb894aba3737988e (patch)
treea75a239302959249a1775c8c0b3bd89425c70d6f
parent2c91b991eee2c16278111f922ba974857e1ae9cd (diff)
scripts: Add color to pacman-key
Use --nocolor to suppress colored output from pacman-key, otherwise output will be in color. Signed-off-by: William Giokas <1007380@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--doc/pacman-key.8.txt3
-rw-r--r--scripts/pacman-key.sh.in5
2 files changed, 7 insertions, 1 deletions
diff --git a/doc/pacman-key.8.txt b/doc/pacman-key.8.txt
index d4a6d5c3..ceedf83b 100644
--- a/doc/pacman-key.8.txt
+++ b/doc/pacman-key.8.txt
@@ -77,6 +77,9 @@ Operations
Locally sign the given key. This is primarily used to root the web of trust
in the local private key generated by '\--init'.
+*\--nocolor*::
+ Disable colored output from pacman-key.
+
*-r, \--recv-keys*::
Equivalent to '\--recv-keys' in GnuPG.
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 8f75e2fd..92875eff 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -43,6 +43,7 @@ POPULATE=0
RECEIVE=0
REFRESH=0
UPDATEDB=0
+USE_COLOR='y'
VERIFY=0
DEFAULT_KEYSERVER='hkp://pool.sks-keyservers.net'
@@ -514,7 +515,7 @@ fi
OPT_SHORT="adefhlruvV"
OPT_LONG=('add' 'config:' 'delete' 'edit-key' 'export' 'finger' 'gpgdir:'
'help' 'import' 'import-trustdb' 'init' 'keyserver:' 'list-keys' 'list-sigs'
- 'lsign-key' 'populate' 'recv-keys' 'refresh-keys' 'updatedb'
+ 'lsign-key' 'nocolor' 'populate' 'recv-keys' 'refresh-keys' 'updatedb'
'verify' 'version')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
exit 1 # E_INVALID_OPTION;
@@ -543,6 +544,7 @@ while (( $# )); do
-l|--list-keys) LISTKEYS=1 ;;
--list-sigs) LISTSIGS=1 ;;
--lsign-key) LSIGNKEY=1 UPDATEDB=1 ;;
+ --nocolor) USE_COLOR='n';;
--populate) POPULATE=1 UPDATEDB=1 ;;
-r|--recv-keys) RECEIVE=1 UPDATEDB=1 ;;
--refresh-keys) REFRESH=1 ;;
@@ -557,6 +559,7 @@ while (( $# )); do
shift
done
+m4_include(library/term_colors.sh)
if ! type -p gpg >/dev/null; then
error "$(gettext "Cannot find the %s binary required for all %s operations.")" "gpg" "pacman-key"