• juanvallejo's avatar
    add linebreak between resource groups · 735fbf9c
    juanvallejo authored
    Printing multiple groups via `kubectl get all` can produce output that is
    hard to read in cases where there are a lot of resource types to display
    / some resource types contain varying column amounts.
    
    This patch adds a linebreak above each group of resources only when
    there is more than one group to display, and always omitting the
    linebreak above the first group. This makes for slightly improved
    output.
    
    Linebreaks are printed to stderr, and honor the `--no-headers` option.
    
    **Before**
    
    ```
    $ kubectl get all
    NAME                     READY     STATUS    RESTARTS   AGE
    po/database-1-u9m9l      1/1       Running   3          5d
    po/idling-echo-1-9fmz6   2/2       Running   8          5d
    po/idling-echo-1-gzb0v   2/2       Running   4          5d
    NAME               DESIRED   CURRENT   READY     AGE
    rc/database-1      1         1         1         6d
    rc/idling-echo-1   2         2         2         6d
    NAME              CLUSTER-IP       EXTERNAL-IP   PORT(S)
    AGE
    svc/database      172.30.11.104    <none>        5434/TCP
    6d
    svc/frontend      172.30.196.217   <none>        5432/TCP
    6d
    svc/idling-echo   172.30.115.67    <none>        8675/TCP,3090/UDP
    6d
    svc/kubernetes    172.30.0.1       <none>        443/TCP,53/UDP,53/TCP
    6d
    svc/mynodeport    172.30.81.254    <nodes>       8080/TCP
    5d
    svc/mynodeport1   172.30.198.193   <nodes>       8080/TCP
    5d
    svc/mynodeport2   172.30.149.48    <nodes>       8080/TCP
    5d
    svc/mynodeport3   172.30.195.235   <nodes>       8080/TCP
    5d
    ```
    
    **After**
    
    ```
    $ kubectl get all
    NAME                     READY     STATUS    RESTARTS   AGE
    po/database-1-u9m9l      1/1       Running   3          5d
    po/idling-echo-1-9fmz6   2/2       Running   8          5d
    po/idling-echo-1-gzb0v   2/2       Running   4          5d
    
    NAME               DESIRED   CURRENT   READY     AGE
    rc/database-1      1         1         1         6d
    rc/idling-echo-1   2         2         2         6d
    
    NAME              CLUSTER-IP       EXTERNAL-IP   PORT(S)
    AGE
    svc/database      172.30.11.104    <none>        5434/TCP
    6d
    svc/frontend      172.30.196.217   <none>        5432/TCP
    6d
    svc/idling-echo   172.30.115.67    <none>        8675/TCP,3090/UDP
    6d
    svc/kubernetes    172.30.0.1       <none>        443/TCP,53/UDP,53/TCP
    6d
    svc/mynodeport    172.30.81.254    <nodes>       8080/TCP
    5d
    svc/mynodeport1   172.30.198.193   <nodes>       8080/TCP
    5d
    svc/mynodeport2   172.30.149.48    <nodes>       8080/TCP
    5d
    svc/mynodeport3   172.30.195.235   <nodes>       8080/TCP
    5d
    ```
    735fbf9c
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api/swagger-spec Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
contrib Loading commit data...
docs Loading commit data...
examples Loading commit data...
federation Loading commit data...
hack Loading commit data...
hooks Loading commit data...
logo Loading commit data...
pkg Loading commit data...
plugin Loading commit data...
staging Loading commit data...
test Loading commit data...
third_party Loading commit data...
vendor Loading commit data...
www Loading commit data...
.generated_docs Loading commit data...
.gitignore Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIB.md Loading commit data...
CONTRIBUTING.md Loading commit data...
DESIGN.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
Makefile.generated_files Loading commit data...
OWNERS Loading commit data...
README.md Loading commit data...
Vagrantfile Loading commit data...
code-of-conduct.md Loading commit data...
labels.yaml Loading commit data...