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

Re: "Pull just the text of a single command" (was Re: .zsh_history)




On 2023-04-16 08:53, Bart Schaefer wrote:
It's much worse than that, consider
You know, as a logician I'm quite aware that there are things one might ask for that are logically not possible to deliver.  It's Godel's Theorem applied to tokens.  Heavy duty stuff.  In my case close will count.
% my_function one && my_function $PATH || my_function three > filename

Or pipelines, or backgrounding, or if/then/else/fi, etc.  You will
need to define what you intend in each case (please, not by writing it
in prose here).

The ${(z)...} expansion does a best-case job of mimicking the parser,
so you can start by using ${(z)1} in preexec and work forward from
there.  The simple case with semicolons can be handled by

chain=( ${(s:; :)${(z)1}} )

That all sounds quite promising.  What I have now works 99% of the time and I'm not interested -- except as a brain-bending puzzle -- in trying to break it, but I think what you're suggesting will be a possible simplification and that will be nice.  Some virgin territory here tho, so I'll be getting stuck most likely.







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