I'm using grc / grcat to colorize my terminal output with this function:
function docker() {
case $* in
ps* ) shift 1; command docker ps "$@" | grcat $HOME/.grc/conf.dockerps ;;
images* ) shift 1; command docker images "$@" | grcat $HOME/.grc/conf.dockerimages ;;
info* ) shift 1; command docker info "$@" | grcat $HOME/.grc/conf.dockerinfo ;;
* ) command docker "$@" ;;
esac
}
but this is breaking the my zsh completions and plugins that I setup using oh-my-zsh in my .zshrc with this:
plugins=(git colored-man-pages colorize vagrant brew ruby docker)
plugins+=(gradle rvm rails bundler gem osx pod)
plugins+=(bower cp go node npm)
plugins+=(zsh-syntax-highlighting encode64)
plugins+=(zsh-completions mvn)
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit && compinit -i
When I try using docker stop
for example, the completion is coming with ANSI escape sequences: $'\033'\[0m$'\033'\[1m$'\033'\[33mhigh_wright$'\033'\[0m
is there a way to avoid that and filter those escape sequences only for completions?
EDIT
I found this file in my .oh-my-zsh dir for the docker plugin: https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/docker/_docker
I understand that I need to change this function but I don't know how.
__docker_containers() {
declare -a cont_cmd
cont_cmd=($(docker ps | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'containers' cont_cmd
}
I was able to fix this by changing the docker plugin from oh-my-zsh that is installed in .oh-my-zsh/plugins/docker/_docker
. To fix it I preceded all helper functions with command
like this:
__docker_containers() {
declare -a cont_cmd
cont_cmd=($(command docker ps | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'containers' cont_cmd
}