-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(zsh): save zsh xtrace output to file
Signed-off-by: vladislav doster <10052309+vladdoster@users.noreply.github.com>
- Loading branch information
1 parent
d31b2c3
commit 9c98570
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#autoload | ||
# | ||
# zsh-xtrace | ||
# | ||
|
||
__zsh-xtrace_usage () { | ||
print -- 'Usage: zsh-xtrace [options] [arguments...]' | ||
print -- 'Options:' | ||
print -- ' -d, --debug turn on execution tracing' | ||
print -- ' -h, --help show list of command-line options' | ||
} | ||
|
||
setopt localoptions extended_glob | ||
zmodload zsh/zutil || return 1 | ||
|
||
local base debug help | ||
builtin zparseopts -D -E -F -K \ | ||
d=debug -debug=debug \ | ||
h=help -help=help \ | ||
|| return 1 | ||
|
||
if (( $#help )); then | ||
__zsh-xtrace_usage | ||
return 0 | ||
fi | ||
|
||
if (( $#debug )); then | ||
setopt xtrace | ||
fi | ||
|
||
local -a arguments=(${(q+)^@}) | ||
|
||
zsh --norcs -lxvc "${@}; return" 2>&1 | ts -i "%.s" | ansifilter > zsh_start.log | ||
print -l -- "${#arguments} args" ${(@)arguments} | ||
|
||
# vim: set expandtab filetype=zsh shiftwidth=2 softtabstop=2 tabstop=2: |