28 lines
682 B
Fish
28 lines
682 B
Fish
|
#!/usr/bin/env fish
|
||
|
import @parent
|
||
|
|
||
|
# calls logger with a specific color
|
||
|
#
|
||
|
# examples:
|
||
|
#
|
||
|
# log "hello there"
|
||
|
# log -c magenta "im berry"
|
||
|
# log --color cc00cc "just like the blueberries"
|
||
|
function log
|
||
|
set -f log_name (parent_script)
|
||
|
# hlwm config particular
|
||
|
set -f cfg_color \
|
||
|
(hc attr settings.my_Color_$log_name 2> /dev/null)
|
||
|
|
||
|
argparse 'c/color=' -- $argv
|
||
|
if not set -q _flag_color; or test -n "$_flag_color"
|
||
|
if test -n "$cfg_color"
|
||
|
set -g _flag_color $cfg_color
|
||
|
else
|
||
|
set -g _flag_color green
|
||
|
end
|
||
|
end
|
||
|
|
||
|
echo -s "[ " (set_color $_flag_color) $log_name (set_color normal) " ]: $argv" 1>&2
|
||
|
end
|