Created
June 21, 2016 11:25
-
-
Save ffledgling/5d635ad3d7bee766e5d7cc901563d1d5 to your computer and use it in GitHub Desktop.
Function to pretty prit yaml file groups in a directory
This file contains hidden or 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
| yamlls() { | |
| local f | |
| local t | |
| local _color | |
| declare -A types=() | |
| for f in *.*.yaml; do | |
| t=${f%.yaml} | |
| types[${t##*.}]=1 | |
| done | |
| _color=0 | |
| for t in "${!types[@]}"; do | |
| tput bold | |
| tput smul | |
| echo ${t}: | |
| tput sgr0 | |
| for _file in $(ls -1 "$@" *."$t.yaml") | |
| do | |
| echo "${_file%${t}.yaml}$(tput setaf $((6 - _color%6)) && tput bold)${t}.yaml" | |
| tput sgr0 | |
| done | |
| ((_color++)) | |
| echo | |
| done | |
| tput sgr0 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment