Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: debug functions



I was afraid the function that call itself is the only way to go here, thanks for confirming
best regards

Pier Paolo Grassi


Il giorno mer 10 feb 2021 alle ore 23:56 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> ha scritto:
On Wed, Feb 10, 2021 at 2:08 PM Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
>
> function_name (){
>   functions -T $0
>   ...
> }

I think it'd be a bit convoluted ...

function_name () {
  if [[ -o xtrace ]]
  then
    # The real function body here
  else
    functions -T function_name
    {
      function_name "$@"
    } always {
      functions +T function_name
    }
  fi
}


Messages sorted by: Reverse Date, Date, Thread, Author