junegunn/fzf

Preserve color output of `kubecolor get pods -A | fzf --ansi`?

tmpm697 opened this issue · 1 comments

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.51.0

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

I have this:

kubecolor get pods -A | fzf --ansi

expect color output of kubecolor preserved but in fact, the color is lost.

Usually, there is an extra option to retain the escape sequences when piped into another command.

See: kubecolor/kubecolor - Dynamic tty support

KUBECOLOR_FORCE_COLORS=true kubecolor ... | fzf ...
# or
kubecolor --force-colors ... | fzf ...
# Enables colors automatically when outputting to the terminal; otherwise, it disables them.
command grep --color=auto '^foo' /usr/share/dict/words
command grep --color=auto '^foo' /usr/share/dict/words | fzf

# vs

# Always enables colorized output.
command grep --color=always '^foo' /usr/share/dict/words | fzf