
私は次のようなものが欲しい:
# 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
答え1
trap
疑似信号として見ることができますDEBUG
。ただし、これはエイリアス拡張後にのみコマンドと機能をトリガーします。詳細はzshのマニュアルを読んでください。コマンドまたは機能を実行して実行される内容に関する情報を提供するため、情報を直接記録するのではなく、完全なデバッガを実装するために使用できると想定できます。
答え2
xtrace をグローバルに有効にします。
> set -x; a a.mp3 a.m4 ; set +x
または、その関数に対してxtraceをオンにして実行します。
> 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