Skip to content

using cat to output to terminal is problematic for people using bat #21

@hamza-m-masood

Description

@hamza-m-masood

There is an open source tool called bat
It is just a fork of cat with more features.

I have this alias in my bashrc:

alias cat='bat'

when I type in kubech I see this kind of output:

───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ STDIN
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ NOTE:
   2   │   - The command "kubech" is just a meta for other commands. So kubech does nothing by itself.
   3   │   - Also short names like "kchc/kchn/kchu" are available.
   4   │
   5   │ VARS:
   6   │   KUBECONFIG_SRC_DIR     : Set directory with extra kubectl config files to read in kubech commands.
   7   │                            This allow to have multiple config files in addition to
   8   │                            the one at "$HOME/.kube/config".
   9   │                            Default: "/Users/hamzamasood/.kube/config.src.d"
  10   │   KUBECONFIG_DEST_DIR    : Set directory for temporary kubectl config files. The files
  11   │                            in this directory are auto-generated by kubech commands
  12   │                            and you don't need to interact with them or even change that var.
  13   │                            Default: "/Users/hamzamasood/.kube/config.dest.d"
  14   │   KUBECH_NAMESPACE_CHECK : Method used to check if namespace exists before switching to it.
  15   │                            The default lists all namespaces which can be slow in large
  16   │                            clusters. After kubernetes 1.22+ all namespaces have a label
  17   │                            that can be used to speed this up. Set to "label" to enable this.
  18   │                            Available options: "list", "label".
  19   │                            Default: "list"
  20   │
  21   │ USAGE:
  22   │   kubechc             : List all contexts
  23   │   kubechc <CONTEXT>   : Switch to context <CONTEXT>
  24   │   kubechn             : List all namespaces
  25   │   kubechn <NAMESPACE> : Switch to namespace <NAMESPACE>
  26   │   kubechu             : Unset the active context. This is just a safty net
  27   │                         to avoid applying config by mistake to the wrong cluster.
───────┴───────────────────────────────────────────────────────────────────────────────────

This is the output I expect:

NOTE:
  - The command "kubech" is just a meta for other commands. So kubech does nothing by itself.
  - Also short names like "kchc/kchn/kchu" are available.

VARS:
  KUBECONFIG_SRC_DIR     : Set directory with extra kubectl config files to read in kubech commands.
                           This allow to have multiple config files in addition to
                           the one at "$HOME/.kube/config".
                           Default: "/Users/hamzamasood/.kube/config.src.d"
  KUBECONFIG_DEST_DIR    : Set directory for temporary kubectl config files. The files
                           in this directory are auto-generated by kubech commands
                           and you don't need to interact with them or even change that var.
                           Default: "/Users/hamzamasood/.kube/config.dest.d"
  KUBECH_NAMESPACE_CHECK : Method used to check if namespace exists before switching to it.
                           The default lists all namespaces which can be slow in large
                           clusters. After kubernetes 1.22+ all namespaces have a label
                           that can be used to speed this up. Set to "label" to enable this.
                           Available options: "list", "label".
                           Default: "list"

USAGE:
  kubechc             : List all contexts
  kubechc <CONTEXT>   : Switch to context <CONTEXT>
  kubechn             : List all namespaces
  kubechn <NAMESPACE> : Switch to namespace <NAMESPACE>
  kubechu             : Unset the active context. This is just a safty net
                        to avoid applying config by mistake to the wrong cluster.


kubech seems to be using cat under the hood and is conflicting with my alias for bat.

I understand that this may be a niche usecase but the bat open source tool is popular enough for me to mention this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions