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

Re: zle separability



> > (... but, by the way, it would still be nice if such uses for zsh were
> > better supported, with for instance support for reading an arbitrary
> > config file or executing an arbitrary fragment before opening an
> > interactive shell, or for a function which can be defined to handle
> > all interactive commands)
> 
>     You already can open an arbitrary config file with zsh using
> /etc/zshrc and $ZDOTDIR/.zshrc and a bit of magic (like an
> environment variable). If you want, you can use '-c' too or '-s' to
> read commands from stdin or from a file. Be careful about closing
> stdin too soon or end your script when you shouldn't ;))
> 
>     If what you want is to run 'zsh --config=configfile', ok, there's
> no support for that.

Yeah, that's what I wanted. Actually, a way to specify an arbitrary
command to execute after everything is loaded (or not, with -f) would
be a bit more general because you'd just set it to ". ./configfile"...
Sure, making a temporary directory with a special .zshrc in it is
mostly equivalent, but seems like zsh shouldn't make you go through
that mess.

>     For the rest I don't understand clearly what do you want. If you
> could give me some use cases I can try to tell you ways of achieving
> what you need.

Sort of like preexec, except that it executes not *before* the command
but *instead of* the command. So you could set it to something like

myexec () { "$@" }

for normal behavior, or if you wanted to, say, send the commands to
your favorite app that doesn't have a readline interface, you could do
that instead. People may say it's too powerful ... but I still think
it would be nice.

Frederik



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