sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

github296-named-execmark.bash (794B)


      1 # blesh/contrib/config/github296-named-execmark.bash (C) 2023, Koichi Murase <myoga.murase@gmail.com>
      2 
      3 function ble/contrib/config:github296/named-execmark.hook {
      4   local lastexit=$? command=$1
      5 
      6   if ((lastexit)) && ! ble/string#match "$command" $'^[[:space:]]*#[^\n]+$'; then
      7     local sgr=$'\e[;94m' sgr0=$'\e[m' sgrE=$'\e[;91m' ret
      8     ble/color/face2sgr-ansi varname_number; local sgrN=$ret
      9 
     10     local exit=$lastexit name=
     11     if ((exit>=128)) && [[ ${name:=${_ble_builtin_trap_sig_name[exit&127]}} ]]; then
     12       exit=$'\e[1m'"$name"$'\e[22m'" ($sgrN$exit$sgrE)"
     13     else
     14       exit="exit $sgrN$exit$sgrE"
     15     fi
     16     local mark=$sgrE'[ble: '$exit']'$sgr0
     17     ble/util/buffer.print "$mark"
     18   fi
     19 }
     20 bleopt exec_errexit_mark=
     21 blehook POSTEXEC!=ble/contrib/config:github296/named-execmark.hook