0

I want something like this:

# source:
a() b mp3 m4a "$@"
b() eval "${1}-to-${2} $@:q"
alias mp3-to-m4a='ffmpeg ...'
# 
$ traceall a a.mp3 a.m4a
 # should return:
 Functions:
 a
 b
 Aliases:
 mp3-to-m4a
 commands:
 ffmpeg
2

You might look at trap with the DEBUG pseudosignal. This only triggers for commands and functions, though, and only after alias expansion. You want to read the details in the zsh manual, because it runs a command or function giving it information about what's about to be executed, rather than recording information directly; you could use this hypothetically to implement a full debugger.

| improve this answer | |
1

Turn xtrace globally:

> set -x; a a.mp3 a.m4 ; set +x

or turn on xtrace for functions, then execute it:

> typeset -tf a   # turns on xtrace for function a and below
> a a.mp3 a.m4

> typeset -Tf a   # turns on xtrace for function a only
> a a.mp3 a.m4
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.