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

Re: time command with shell builtins



On Wed, Jan 25, 2023 at 01:42:43AM +0100, Dominik Vogt wrote:
> On Tue, Jan 24, 2023 at 03:36:51PM -0800, Bart Schaefer wrote:
> > On Tue, Jan 24, 2023 at 3:14 PM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
> > >
> > > As far as I understand there's no reliable access to
> > > which command is being executed in preexec.
> >
> > There's reliable access to what the user typed and to what that
> > expands to after alias replacement.  What else would you be looking
> > for?
>
> Well, it's more or less "if whatever is being executed is
> interactive, I'm not interested in the time".  This is impossible
> to guess from the command name, except in some manually specified
> cases.  Maye a simple "if command is one of emacs, vi, vim, sleep,
> mutt, visudo, bash, zsh, sh" is good enough.  Or I just get used to
> having unnecessary information in the prompt.

Is there a more elegant way to chek if the command is in a
blacklist than this one?

-- snip --
_zsh_recordtime_skip_list=( emacs vi vim zsh bash sh viduso mutt sleep xemacs )
function preexec_recordtime() {
  if [[ -z "${1:|_zsh_recordtime_skip_list}" ]]; then
    psvar[2]=''
  ...
}
-- snip --

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt




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