Created
May 12, 2024 18:47
-
-
Save caruccio/fc182fb4e8b03257ea30682eb91db7ee to your computer and use it in GitHub Desktop.
Example kubectl plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ContainerCreating=$(tput setaf 13) # magenta | |
Pending=$(tput setaf 3) # yellow | |
Running=$(tput setaf 2) # green | |
Error=$(tput setaf 1) # red | |
BackOf="$Error" | |
Terminating=$(tput setaf 8) # gray | |
Finished="$Terminating" | |
Completed="$Terminating" | |
Reset=$(tput sgr0) | |
kubectl $@ \ | |
| sed -e "s/\(.*Pending.*\)/${Pending}\1${reset}/" \ | |
-e "s/\(.*ContainerCreating.*\)/${ContainerCreating}\1${reset}/" \ | |
-e "s/\(.*Running.*\)/${Running}\1${reset}/" \ | |
-e "s/\(.*Error.*\)/${Error}\1${reset}/" \ | |
-e "s/\(.*BackOf.*\)/${BackOf}\1${reset}/" \ | |
-e "s/\(.*Terminating.*\)/${Terminating}\1${reset}/" \ | |
-e "s/\(.*Finished.*\)/${Finished}\1${reset}/" \ | |
-e "s/\(.*Completed.*\)/${Completed}\1${reset}/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment