Use --no-color to suppress colored output Signed-off-by: William Giokas <1007380@gmail.com> --- doc/pacman-key.8.txt | 3 +++ scripts/pacman-key.sh.in | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/pacman-key.8.txt b/doc/pacman-key.8.txt index d4a6d5c..f27c873 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'. +*-m, \--no-color*:: + Suppress 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 8f75e2f..93615ec 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -44,6 +44,7 @@ RECEIVE=0 REFRESH=0 UPDATEDB=0 VERIFY=0 +USE_COLOR='y' DEFAULT_KEYSERVER='hkp://pool.sks-keyservers.net' @@ -64,6 +65,7 @@ usage() { printf -- "$(gettext " -e, --export Export the specified or all keyids")\n" printf -- "$(gettext " -f, --finger List fingerprint for specified or all keyids")\n" printf -- "$(gettext " -l, --list-keys List the specified or all keys")\n" + printf -- "$(gettext " -m, --no-color Suppress colored output")\n" printf -- "$(gettext " -r, --recv-keys Fetch the specified keyids")\n" printf -- "$(gettext " -u, --updatedb Update the trustdb of pacman")\n" printf -- "$(gettext " -v, --verify Verify the file(s) specified by the signature(s)")\n" @@ -511,10 +513,10 @@ if ! type gettext &>/dev/null; then } fi -OPT_SHORT="adefhlruvV" +OPT_SHORT="adefhlmruvV" 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' 'no-color' 'populate' 'recv-keys' 'refresh-keys' 'updatedb' 'verify' 'version') if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then exit 1 # E_INVALID_OPTION; @@ -543,6 +545,7 @@ while (( $# )); do -l|--list-keys) LISTKEYS=1 ;; --list-sigs) LISTSIGS=1 ;; --lsign-key) LSIGNKEY=1 UPDATEDB=1 ;; + -m|--no-color) USE_COLOR='n' ;; --populate) POPULATE=1 UPDATEDB=1 ;; -r|--recv-keys) RECEIVE=1 UPDATEDB=1 ;; --refresh-keys) REFRESH=1 ;; @@ -557,6 +560,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" -- 1.8.2.rc1.24.g06d67b8