Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: More verbose && ?
- X-seq: zsh-users 14742
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: More verbose && ?
- Date: Sun, 24 Jan 2010 00:13:20 -0800
- In-reply-to: <2d460de71001200934m9769985m9ad0281eae256d4a@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <2d460de71001200834i7037df54h647f7b01d6ebdc4@xxxxxxxxxxxxxx> <chaz20100120171020.GC3872@xxxxxxxx> <2d460de71001200934m9769985m9ad0281eae256d4a@xxxxxxxxxxxxxx>
On Jan 20, 6:34pm, Richard Hartmann wrote:
}
} I would definitely prefer an invisible and automagic way, ideally
} activated via an option.
I think you're unlikely to get your wish in exactly that form, but
if someone is feeling ambitious, here are some pointers:
Look in Src/exec.c for the comment
/* Get the text associated with this command. */
The variable "text" assigned there is the closest approximation to
what you'd like reported. By the time zsh gets around to executing a
command, it has been rearranged by the parser into bytecode sequences,
and without going through the same exercises that the XTRACE option
enables, the exact text can't be regenerated. For example, in a math
expression like (( 0 )) the "text" is entirely gone and would have
to be reconstructed in execarith(). There are a lot of special
cases to cover.
In any case, that text would then need to be stashed somewhere from
whence it could later be retrieved and printed. E.g., if it were
stored in the parameter $ZSH_LAST_CMD, then Richard could almost get
what he wants by using
TRAPZERR() { print -R "Error($?): $ZSH_LAST_CMD" }
I say "almost" because when one of the "branches" of the && list is
a shell function or other complex command, it' unclear to me what
the "last command" will end up being.
Aside to -workers: Shouldn't ZSH_DEBUG_CMD be mentioned in the section
of the manual for "parameters set by the shell"?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author