More Xeno & Fish!

Here’s another little snippet for anyone interested… I wanted my Terminal prompt to show all active sessions, for easy memory that I may have left one open, but it was a little dull. Being a Viz guy, what can I do to make it better? Add Color! So below, find a little fish function that you can add to your fish_prompt.fish script (or just call manually) for nicely colored output as shown above.

# xeno_list
function xeno_list --description 'Colored xeno list results'
for s in  ( xeno-list );
    set -l xen_id (echo $s | cut -d ':' -f 1)
    set -l xen_desc (echo $s | cut -d ':' -f 2-)

    set -l xen_array (echo $s | tr ' ' \n)
    set -l statuscolor (set_color green)
    set -l desccolor (set_color normal)
    if test $xen_array[-1] = "unsynced"
        set statuscolor (set_color red)
        set desccolor (set_color yellow)
    end

    echo $statuscolor\[$xen_id\] $desccolor $xen_desc (set_color normal)
end
end

comments powered by Disqus