[-- Attachment #1: Type: text/plain, Size: 961 bytes --] Has anybody written a "zsh wtf" style tool where a complex expression is annotated, similar to "explainshell.com"? The more I learn about Zsh, the more obscure and hard-to-read my code is. $ command date Tue Nov 23 20:17:53 CST 2021 $ ls -la *(.Dmm-3) -rw-r--r-- 1 zachriggle staff 0 Nov 23 20:17 file_10 -rw-r--r-- 1 zachriggle staff 0 Nov 23 20:15 file_8 -rw-r--r-- 1 zachriggle staff 0 Nov 23 20:16 file_9 Is definitely very convenient -- but only if you know what's going on. Other, more documented commands can achieve roughly the same thing. $ find . -Bmin -3 -type f -maxdepth 1 | xargs ls -la -rw-r--r-- 1 zachriggle staff 0 Nov 23 20:17 ./file_10 -rw-r--r-- 1 zachriggle staff 0 Nov 23 20:15 ./file_8 -rw-r--r-- 1 zachriggle staff 0 Nov 23 20:16 ./file_9 Is there any interest in something like ExplainShell or ShellCheck for Zsh? I'm not sure what tools are best fit for parsing things like complicated expressions. *Zach Riggle* [-- Attachment #2: Type: text/html, Size: 2118 bytes --]
Zach Riggle wrote on Tue, Nov 23, 2021 at 20:58:52 -0600: > $ ls -la *(.Dmm-3) ⋮ > Is there any interest in something like ExplainShell or ShellCheck for > Zsh? I'm not sure what tools are best fit for parsing things like > complicated expressions. Truncating the command line after each character and doing headless completions (https://github.com/Valodim/zsh-capture-completion) might be a good start. For --options to builtins you could potentially make it a lot smarter by looking in the manual sources. Given «foo -x», jump to the [a-z]index(foo) line, then show either the «item(tt(-x))», if there is one, or the output of a sentence-wise grep for «tt(-x)» (taking the parentheses as literals). As to your question, you might've gotten better answers if you'd given a self-contained description (or at least examples) of the proposed functionality. Cheers, Daniel
[-- Attachment #1: Type: text/plain, Size: 811 bytes --] On 24/11/2021 02:58, Zach Riggle wrote: > Has anybody written a "zsh wtf" style tool where a complex expression > is annotated, similar to "explainshell.com <http://explainshell.com>"? > > The more I learn about Zsh, the more obscure and hard-to-read my code is. > > $ command date > Tue Nov 23 20:17:53 CST 2021 > > > $ ls -la *(.Dmm-3) > -rw-r--r-- 1 zachriggle staff 0 Nov 23 20:17 file_10 > -rw-r--r-- 1 zachriggle staff 0 Nov 23 20:15 file_8 > -rw-r--r-- 1 zachriggle staff 0 Nov 23 20:16 file_9 > > Zach I recovered the following page from the old zsh Wiki website from the wayback machine *http://zzapper.co.uk/charindex.html* * * *I always found it useful for decoding zsh syntax* * * *Along with* * * *http://www.bash2zsh.com/zsh_refcard/refcard.pdf* * * *zzapper * * * ** [-- Attachment #2: Type: text/html, Size: 3396 bytes --]
On Wed, Dec 1, 2021 at 9:27 AM zzapper <zsh@rayninfo.co.uk> wrote:
>
> Zach I recovered the following page from the old zsh Wiki website from the wayback machine
>
> http://zzapper.co.uk/charindex.html
If anyone would like to update this I expect we could get it onto the
zsh.org website.
There are some obvious omissions even in the first few entries, for
example $'...' quoting which has been around for years.
On 01/12/2021 18:40, Bart Schaefer wrote: > On Wed, Dec 1, 2021 at 9:27 AM zzapper <zsh@rayninfo.co.uk> wrote: >> Zach I recovered the following page from the old zsh Wiki website from the wayback machine >> >> http://zzapper.co.uk/charindex.html > If anyone would like to update this I expect we could get it onto the > zsh.org website. > > There are some obvious omissions even in the first few entries, for > example $'...' quoting which has been around for years. > Good idea If someone is able to do this I think they can just wget http://zzapper.co.uk/charindex.html The original page had some pretty complex css which I attempted to simplify. zzapper
david rayner wrote on Wed, Dec 01, 2021 at 18:52:01 +0000: > > On 01/12/2021 18:40, Bart Schaefer wrote: > > On Wed, Dec 1, 2021 at 9:27 AM zzapper <zsh@rayninfo.co.uk> wrote: > > > Zach I recovered the following page from the old zsh Wiki website from the wayback machine > > > > > > http://zzapper.co.uk/charindex.html Thanks for digging that up. When I look up the definition of ${(X)} or ${foo[(X)]} or ${foo:X} or %X or *(X) in the manual, I don't always remember whether the string to grep for is a bare "X" (at the start of the line with whitespace after it), or X with its "sigil", i.e., "(X)"/":X"/"%x". The format of that page solves this problem. > > If anyone would like to update this I expect we could get it onto the > > zsh.org website. Yeah. We could add it to the FAQ sources, so it'll be updated in lockstep with everything else in zsh.git and be updated automatically upon new releases — but see below. > > There are some obvious omissions even in the first few entries, for > > example $'...' quoting which has been around for years. > > > Good idea If someone is able to do this I think they can just wget > > http://zzapper.co.uk/charindex.html > > > The original page had some pretty complex css which I attempted to simplify. What's the copyright license of the contents of the original page? Cheers, Daniel