New line not handled correctly
oschusler opened this issue · 0 comments
oschusler commented
What did you do?
Based on the colourfiles, I created the following conf.kubectlget
:
# HEADERS
regexp=(?:^|\ )([A-Z]+[\-\ \(]?[A-Z]+[\-\)]?[A-Z]*)(?:\ |$)
colours=default,underline
and addition to the grc.conf
file:
# kubectl get
(^|[/\w\.]+/)kubectl get\s?
conf.kubectlget
The input for this regexp is kubectl get all --all-namespaces
, which contains newlines (see below for example).
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/coredns-78fcdf6894-g4p2k 1/1 Running 0 25m
kube-system pod/coredns-78fcdf6894-psqlm 1/1 Running 0 5h
kube-system pod/etcd-master 1/1 Running 0 5h
kube-system pod/kube-apiserver-master 1/1 Running 0 5h
kube-system pod/kube-controller-manager-master 1/1 Running 0 5h
kube-system pod/kube-flannel-ds-amd64-56dk7 1/1 Running 0 5h
kube-system pod/kube-flannel-ds-amd64-jr2d4 1/1 Running 0 5h
kube-system pod/kube-flannel-ds-amd64-l7v9c 1/1 Running 0 5h
kube-system pod/kube-flannel-ds-amd64-s65tm 1/1 Running 0 5h
kube-system pod/kube-proxy-2zrj4 1/1 Running 0 5h
kube-system pod/kube-proxy-cwk6r 1/1 Running 0 5h
kube-system pod/kube-proxy-kpr7w 1/1 Running 0 5h
kube-system pod/kube-proxy-wdnmt 1/1 Running 0 5h
kube-system pod/kube-scheduler-master 1/1 Running 0 5h
kube-system pod/tiller-deploy-759cb9df9-qfvkq 1/1 Running 0 5h
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 5h
kube-system service/kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP 5h
kube-system service/tiller-deploy ClusterIP 10.104.99.250 <none> 44134/TCP 5h
NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-system daemonset.apps/kube-flannel-ds-amd64 4 4 4 4 4 beta.kubernetes.io/arch=amd64 5h
kube-system daemonset.apps/kube-flannel-ds-arm 0 0 0 0 0 beta.kubernetes.io/arch=arm 5h
kube-system daemonset.apps/kube-flannel-ds-arm64 0 0 0 0 0 beta.kubernetes.io/arch=arm64 5h
kube-system daemonset.apps/kube-flannel-ds-ppc64le 0 0 0 0 0 beta.kubernetes.io/arch=ppc64le 5h
kube-system daemonset.apps/kube-flannel-ds-s390x 0 0 0 0 0 beta.kubernetes.io/arch=s390x 5h
kube-system daemonset.apps/kube-proxy 4 4 4 4 4 beta.kubernetes.io/arch=amd64 5h
NAMESPACE NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
kube-system deployment.apps/coredns 2 2 2 2 5h
kube-system deployment.apps/tiller-deploy 1 1 1 1 5h
NAMESPACE NAME DESIRED CURRENT READY AGE
kube-system replicaset.apps/coredns-78fcdf6894 2 2 2 5h
kube-system replicaset.apps/tiller-deploy-759cb9df9 1 1 1 5h
What happened?
Based on this regexp, my newlines get 'jumbled' to use the correct technical term. Sometimes, they are all gathered at the top of the output, and sometimes, they are spread somewhere in the middle of the output, like:
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/coredns-78fcdf6894-g4p2k 1/1 Running 0 20m
kube-system pod/coredns-78fcdf6894-psqlm 1/1 Running 0 5h
kube-system pod/etcd-master 1/1 Running 0 5h
kube-system pod/kube-apiserver-master 1/1 Running 0 5h
kube-system pod/kube-controller-manager-master 1/1 Running 0 5h
kube-system pod/kube-flannel-ds-amd64-56dk7 1/1 Running 0 5h
kube-system pod/kube-flannel-ds-amd64-jr2d4 1/1 Running 0 5h
kube-system pod/kube-flannel-ds-amd64-l7v9c 1/1 Running 0 5h
kube-system pod/kube-flannel-ds-amd64-s65tm 1/1 Running 0 5h
kube-system pod/kube-proxy-2zrj4 1/1 Running 0 5h
kube-system pod/kube-proxy-cwk6r 1/1 Running 0 5h
kube-system pod/kube-proxy-kpr7w 1/1 Running 0 5h
kube-system pod/kube-proxy-wdnmt 1/1 Running 0 5h
kube-system pod/kube-scheduler-master 1/1 Running 0 5h
kube-system pod/tiller-deploy-759cb9df9-qfvkq 1/1 Running 0 5h
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 5h
kube-system service/kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP 5h
kube-system service/tiller-deploy ClusterIP 10.104.99.250 <none> 44134/TCP 5h
NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-system daemonset.apps/kube-flannel-ds-amd64 4 4 4 4 4 beta.kubernetes.io/arch=amd64 5h
kube-system daemonset.apps/kube-flannel-ds-arm 0 0 0 0 0 beta.kubernetes.io/arch=arm 5h
kube-system daemonset.apps/kube-flannel-ds-arm64 0 0 0 0 0 beta.kubernetes.io/arch=arm64 5h
kube-system daemonset.apps/kube-flannel-ds-ppc64le 0 0 0 0 0 beta.kubernetes.io/arch=ppc64le 5h
kube-system daemonset.apps/kube-flannel-ds-s390x 0 0 0 0 0 beta.kubernetes.io/arch=s390x 5h
kube-system daemonset.apps/kube-proxy 4 4 4 4 4 beta.kubernetes.io/arch=amd64 5h
NAMESPACE NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
kube-system deployment.apps/coredns 2 2 2 2 5h
kube-system deployment.apps/tiller-deploy 1 1 1 1 5h
NAMESPACE NAME DESIRED CURRENT READY AGE
kube-system replicaset.apps/coredns-78fcdf6894 2 2 2 5h
kube-system replicaset.apps/tiller-deploy-759cb9df9 1 1 1 5h
What did you expect?
I expected the output to stay the same, with the noticable difference of having underscores under the headers. Do I do something wrong, or are newlines something grc can't handle correctly?