zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 1/4] run-help: Support variables in aliases
@ 2023-05-17 22:12 Jörg Sommer
  2023-05-17 22:12 ` [PATCH 2/4] run-help-ip: Reduce the match for link to l Jörg Sommer
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jörg Sommer @ 2023-05-17 22:12 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

If the alias definition starts with a variable assignment, run-help fails,
because it sees the variable assignment as command. Hence, skip all
variable assignments and noglob|nocorrect thereafter.

Example:

% alias LCC='LC_ALL=C'
% alias T='LCC true'
% run-help T
---
 Functions/Misc/run-help | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index 462044b72..438f76122 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -56,13 +56,28 @@ do
     [[ -n $noalias && $what = *" is an alias "* ]] && continue
     builtin print -r $what
     case $what in
-    (*( is an alias for (noglob|nocorrect))*)
-	[[ ${what[(w)7]:t} != ${what[(w)1]} ]] &&
-	  run_help_orig_cmd=${what[(w)1]} run-help ${what[(w)7]:t} ${(z)${what[(w)8,-1]}}
-	;;
     (*( is an alias)*)
-	[[ ${what[(w)6]:t} != ${what[(w)1]} ]] &&
-	  run_help_orig_cmd=${what[(w)1]} run-help ${what[(w)6]:t} ${(z)${what[(w)7,-1]}}
+        local expansion=( ${${=what}[6,-1]} )
+        while true
+        do
+            if [[ $expansion[1] == *=* ]]
+            then
+                shift expansion
+            elif [[ $expansion[1] == (noglob|nocorrect) ]]
+            then
+                shift expansion
+                break
+            elif [[ $expansion[1] != $1 ]] && alias $expansion[1] >/dev/null
+            then
+                expansion=( ${=$(builtin whence $expansion[1])} $expansion[2,-1] )
+            else
+                break
+            fi
+        done
+
+        expansion[1]=$expansion[1]:t
+        [[ $expansion[1] != ${what[(w)1]} ]] &&
+          run_help_orig_cmd=${what[(w)1]} run-help $expansion[@]
 	;;
     (*( is a * function))
 	case ${what[(w)1]} in
-- 
2.40.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 2/4] run-help-ip: Reduce the match for link to l
  2023-05-17 22:12 [PATCH 1/4] run-help: Support variables in aliases Jörg Sommer
@ 2023-05-17 22:12 ` Jörg Sommer
  2023-05-17 22:12 ` [PATCH 3/4] run-help-openssl: Reduce the code Jörg Sommer
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Jörg Sommer @ 2023-05-17 22:12 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

ip accepts the reduction of link to l.
---
 Functions/Misc/run-help-ip | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Functions/Misc/run-help-ip b/Functions/Misc/run-help-ip
index b811ce352..f635cce71 100644
--- a/Functions/Misc/run-help-ip
+++ b/Functions/Misc/run-help-ip
@@ -18,7 +18,7 @@ case $1 in
     (addrl*) man ip-addrlabel ;;
     (a*) man ip-address ;;
     (l2*) man ip-l2tp ;;
-    (li*) man ip-link ;;
+    (l*) man ip-link ;;
     (ma*) man ip-maddress ;;
     (mo*) man ip-monitor ;;
     (mr*) man ip-mroute ;;
-- 
2.40.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 3/4] run-help-openssl: Reduce the code
  2023-05-17 22:12 [PATCH 1/4] run-help: Support variables in aliases Jörg Sommer
  2023-05-17 22:12 ` [PATCH 2/4] run-help-ip: Reduce the match for link to l Jörg Sommer
@ 2023-05-17 22:12 ` Jörg Sommer
  2023-05-17 22:12 ` [PATCH 4/4] run-help for docker, perf, podman, ssh, svnadmin Jörg Sommer
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Jörg Sommer @ 2023-05-17 22:12 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

---
 Functions/Misc/run-help-openssl | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/Functions/Misc/run-help-openssl b/Functions/Misc/run-help-openssl
index c528418c8..88293b252 100644
--- a/Functions/Misc/run-help-openssl
+++ b/Functions/Misc/run-help-openssl
@@ -1,7 +1 @@
-
-if [ $# -eq 0 ]; then
-    man openssl
-else
-    man $1
-fi
-
+man ${1:-openssl}
-- 
2.40.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 4/4] run-help for docker, perf, podman, ssh, svnadmin
  2023-05-17 22:12 [PATCH 1/4] run-help: Support variables in aliases Jörg Sommer
  2023-05-17 22:12 ` [PATCH 2/4] run-help-ip: Reduce the match for link to l Jörg Sommer
  2023-05-17 22:12 ` [PATCH 3/4] run-help-openssl: Reduce the code Jörg Sommer
@ 2023-05-17 22:12 ` Jörg Sommer
  2023-05-31 17:45   ` [PATCH v2] " Jörg Sommer
  2023-05-17 22:45 ` [PATCH 1/4] run-help: Support variables in aliases Bart Schaefer
  2023-05-23 16:25 ` [PATCH v2] run-help-openssl: Reduce code and use new manpages Jörg Sommer
  4 siblings, 1 reply; 13+ messages in thread
From: Jörg Sommer @ 2023-05-17 22:12 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

---
 Functions/Misc/run-help-docker   | 9 +++++++++
 Functions/Misc/run-help-perf     | 1 +
 Functions/Misc/run-help-podman   | 9 +++++++++
 Functions/Misc/run-help-ssh      | 6 ++++++
 Functions/Misc/run-help-svnadmin | 1 +
 5 files changed, 26 insertions(+)
 create mode 100644 Functions/Misc/run-help-docker
 create mode 100644 Functions/Misc/run-help-perf
 create mode 100644 Functions/Misc/run-help-podman
 create mode 100644 Functions/Misc/run-help-ssh
 create mode 100644 Functions/Misc/run-help-svnadmin

diff --git a/Functions/Misc/run-help-docker b/Functions/Misc/run-help-docker
new file mode 100644
index 000000000..09a8a221a
--- /dev/null
+++ b/Functions/Misc/run-help-docker
@@ -0,0 +1,9 @@
+if [[ $# == 0 ]]
+then
+    man docker
+elif [[ $# > 1 && $1 == (builder|checkpoint|config|container|context|image|manifest|network|node|plugin|secret|service|stack|swarm|system|trust|volume) ]]
+then
+    man docker-$1-$2
+else
+    man docker-$1
+fi
diff --git a/Functions/Misc/run-help-perf b/Functions/Misc/run-help-perf
new file mode 100644
index 000000000..2e0695af2
--- /dev/null
+++ b/Functions/Misc/run-help-perf
@@ -0,0 +1 @@
+man perf${1:+-$1}
diff --git a/Functions/Misc/run-help-podman b/Functions/Misc/run-help-podman
new file mode 100644
index 000000000..64d9cd83f
--- /dev/null
+++ b/Functions/Misc/run-help-podman
@@ -0,0 +1,9 @@
+if [[ $# == 0 ]]
+then
+    man podman
+elif [[ $# > 1 && $1 == (container|generate|healthcheck|image|kube|machine|manifest|network|pod|secret|system|volume) ]]
+then
+    man podman-$1-$2
+else
+    man podman-$1
+fi
diff --git a/Functions/Misc/run-help-ssh b/Functions/Misc/run-help-ssh
new file mode 100644
index 000000000..3ed9b3a09
--- /dev/null
+++ b/Functions/Misc/run-help-ssh
@@ -0,0 +1,6 @@
+if [[ $# -eq 0 ]]
+then
+    man ssh
+else
+    run-help $1
+fi
diff --git a/Functions/Misc/run-help-svnadmin b/Functions/Misc/run-help-svnadmin
new file mode 100644
index 000000000..dbddd6396
--- /dev/null
+++ b/Functions/Misc/run-help-svnadmin
@@ -0,0 +1 @@
+svnadmin help $1 | ${=PAGER:-more}
-- 
2.40.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] run-help: Support variables in aliases
  2023-05-17 22:12 [PATCH 1/4] run-help: Support variables in aliases Jörg Sommer
                   ` (2 preceding siblings ...)
  2023-05-17 22:12 ` [PATCH 4/4] run-help for docker, perf, podman, ssh, svnadmin Jörg Sommer
@ 2023-05-17 22:45 ` Bart Schaefer
  2023-05-18  6:52   ` Jörg Sommer
  2023-05-18  9:02   ` Peter Stephenson
  2023-05-23 16:25 ` [PATCH v2] run-help-openssl: Reduce code and use new manpages Jörg Sommer
  4 siblings, 2 replies; 13+ messages in thread
From: Bart Schaefer @ 2023-05-17 22:45 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: zsh-workers

On Wed, May 17, 2023 at 3:13 PM Jörg Sommer <joerg@jo-so.de> wrote:
>
> If the alias definition starts with a variable assignment, run-help fails,
> because it sees the variable assignment as command. Hence, skip all
> variable assignments and noglob|nocorrect thereafter.

This may not be the right way to handle this.  The same thing is
already being attempted in the block at

    (*)
        if ((! didman++))
        then

where you'll see

                # Discard the command itself & everything before it.

so I would have expected the existing recursive call to cover it.  If
recursion is NOT handling it, then maybe we need to pull that whole
thing up to before the original "whence" command?

Either way, we already have

    (*( is an alias for (noglob|nocorrect))*)

which would be made redundant by your addition of

+            elif [[ $expansion[1] == (noglob|nocorrect) ]]

I repeat my earlier remarks about "reaching the point of diminishing
returns" with our attempts to turn run-help into a full command-line
parser.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] run-help: Support variables in aliases
  2023-05-17 22:45 ` [PATCH 1/4] run-help: Support variables in aliases Bart Schaefer
@ 2023-05-18  6:52   ` Jörg Sommer
  2023-05-18  9:02   ` Peter Stephenson
  1 sibling, 0 replies; 13+ messages in thread
From: Jörg Sommer @ 2023-05-18  6:52 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1613 bytes --]

Bart Schaefer schrieb am Wed 17. May, 15:45 (-0700):
> On Wed, May 17, 2023 at 3:13 PM Jörg Sommer <joerg@jo-so.de> wrote:
> >
> > If the alias definition starts with a variable assignment, run-help fails,
> > because it sees the variable assignment as command. Hence, skip all
> > variable assignments and noglob|nocorrect thereafter.
> 
> This may not be the right way to handle this.  The same thing is
> already being attempted in the block at
> 
>     (*)
>         if ((! didman++))
>         then
> 
> where you'll see
> 
>                 # Discard the command itself & everything before it.
> 
> so I would have expected the existing recursive call to cover it.  If
> recursion is NOT handling it, then maybe we need to pull that whole
> thing up to before the original "whence" command?

At least for me, the current code doesn't work:

```
% zsh -f
zenbook% lsb_release -d
Description:    Debian GNU/Linux 12 (bookworm)
zenbook% echo $ZSH_VERSION
5.9

zenbook% alias LCC='LC_ALL=C'; alias T='LCC true'
zenbook% run-help T
No manual entry for T
```

> Either way, we already have
> 
>     (*( is an alias for (noglob|nocorrect))*)

The patch eliminates this case, since the code to remove the variables also
belongs there.

> I repeat my earlier remarks about "reaching the point of diminishing
> returns" with our attempts to turn run-help into a full command-line
> parser.

I see. That's a fair point. What would be a better attempt to support
variables in aliases?

-- 
Dein Gesicht wird dir geschenkt. Lächeln musst du selbst! (Inga Hermann)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 269 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] run-help: Support variables in aliases
  2023-05-17 22:45 ` [PATCH 1/4] run-help: Support variables in aliases Bart Schaefer
  2023-05-18  6:52   ` Jörg Sommer
@ 2023-05-18  9:02   ` Peter Stephenson
  1 sibling, 0 replies; 13+ messages in thread
From: Peter Stephenson @ 2023-05-18  9:02 UTC (permalink / raw)
  To: Bart Schaefer, Jörg Sommer; +Cc: zsh-workers

> On 17/05/2023 23:45 Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
>  
> On Wed, May 17, 2023 at 3:13 PM Jörg Sommer <joerg@jo-so.de> wrote:
> >
> > If the alias definition starts with a variable assignment, run-help fails,
> > because it sees the variable assignment as command. Hence, skip all
> > variable assignments and noglob|nocorrect thereafter.
> 
> This may not be the right way to handle this.  The same thing is
> already being attempted in the block at
> 
>     (*)
>         if ((! didman++))
>         then
> 
> where you'll see
> 
>                 # Discard the command itself & everything before it.
> 
> so I would have expected the existing recursive call to cover it.

I think the key thing here is the line

	    if whence "run-help-$1:t" >/dev/null

so the bit you're talking about is only run if $1 has a run-help
subfunction.  Obviously this isn't Jörg's case.

What's going on at this point is a bit obscure, but I'm not
convinced the "discard options, parameter assignments and
paths" has anything to do with the zsh common line handling.
I think it's getting rid of anything in the arguments to the
command with the specialised run-help that might not help
the run-help-blah work.  So something like

mycmd var=var1 subcmd

is munged to run

run-help-mycmd subcmd

> If
> recursion is NOT handling it, then maybe we need to pull that whole
> thing up to before the original "whence" command?

I think this is actually an entirely different case, but someone
could authoritatively tell me I'm wrong.

pws


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2] run-help-openssl: Reduce code and use new manpages
  2023-05-17 22:12 [PATCH 1/4] run-help: Support variables in aliases Jörg Sommer
                   ` (3 preceding siblings ...)
  2023-05-17 22:45 ` [PATCH 1/4] run-help: Support variables in aliases Bart Schaefer
@ 2023-05-23 16:25 ` Jörg Sommer
  4 siblings, 0 replies; 13+ messages in thread
From: Jörg Sommer @ 2023-05-23 16:25 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

Openssl switches the naming of manpages to the common style
openssl-$SUBCOMMAND, e.g. openssl-enc. For backward compatibility try to
show the manpage with the old name if the new one doesn't exist.
---
 Functions/Misc/run-help-openssl | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/Functions/Misc/run-help-openssl b/Functions/Misc/run-help-openssl
index c528418c8..e4e45070e 100644
--- a/Functions/Misc/run-help-openssl
+++ b/Functions/Misc/run-help-openssl
@@ -1,7 +1 @@
-
-if [ $# -eq 0 ]; then
-    man openssl
-else
-    man $1
-fi
-
+man openssl${1:+-$1} || man ${1:-openssl}
-- 
2.40.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2] run-help for docker, perf, podman, ssh, svnadmin
  2023-05-17 22:12 ` [PATCH 4/4] run-help for docker, perf, podman, ssh, svnadmin Jörg Sommer
@ 2023-05-31 17:45   ` Jörg Sommer
  2023-09-20 22:41     ` Oliver Kiddle
  0 siblings, 1 reply; 13+ messages in thread
From: Jörg Sommer @ 2023-05-31 17:45 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

---
 Functions/Misc/run-help-docker   | 9 +++++++++
 Functions/Misc/run-help-perf     | 1 +
 Functions/Misc/run-help-podman   | 9 +++++++++
 Functions/Misc/run-help-ssh      | 6 ++++++
 Functions/Misc/run-help-svnadmin | 1 +
 5 files changed, 26 insertions(+)
 create mode 100644 Functions/Misc/run-help-docker
 create mode 100644 Functions/Misc/run-help-perf
 create mode 100644 Functions/Misc/run-help-podman
 create mode 100644 Functions/Misc/run-help-ssh
 create mode 100644 Functions/Misc/run-help-svnadmin

diff --git a/Functions/Misc/run-help-docker b/Functions/Misc/run-help-docker
new file mode 100644
index 000000000..09a8a221a
--- /dev/null
+++ b/Functions/Misc/run-help-docker
@@ -0,0 +1,9 @@
+if [[ $# == 0 ]]
+then
+    man docker
+elif [[ $# > 1 && $1 == (builder|checkpoint|config|container|context|image|manifest|network|node|plugin|secret|service|stack|swarm|system|trust|volume) ]]
+then
+    man docker-$1-$2
+else
+    man docker-$1
+fi
diff --git a/Functions/Misc/run-help-perf b/Functions/Misc/run-help-perf
new file mode 100644
index 000000000..2e0695af2
--- /dev/null
+++ b/Functions/Misc/run-help-perf
@@ -0,0 +1 @@
+man perf${1:+-$1}
diff --git a/Functions/Misc/run-help-podman b/Functions/Misc/run-help-podman
new file mode 100644
index 000000000..64d9cd83f
--- /dev/null
+++ b/Functions/Misc/run-help-podman
@@ -0,0 +1,9 @@
+if [[ $# == 0 ]]
+then
+    man podman
+elif [[ $# > 1 && $1 == (container|generate|healthcheck|image|kube|machine|manifest|network|pod|secret|system|volume) ]]
+then
+    man podman-$1-$2
+else
+    man podman-$1
+fi
diff --git a/Functions/Misc/run-help-ssh b/Functions/Misc/run-help-ssh
new file mode 100644
index 000000000..9c48596ff
--- /dev/null
+++ b/Functions/Misc/run-help-ssh
@@ -0,0 +1,6 @@
+if [[ $# < 2 ]]
+then
+    man ssh
+else
+    run-help $2
+fi
diff --git a/Functions/Misc/run-help-svnadmin b/Functions/Misc/run-help-svnadmin
new file mode 100644
index 000000000..dbddd6396
--- /dev/null
+++ b/Functions/Misc/run-help-svnadmin
@@ -0,0 +1 @@
+svnadmin help $1 | ${=PAGER:-more}
-- 
2.40.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] run-help for docker, perf, podman, ssh, svnadmin
  2023-05-31 17:45   ` [PATCH v2] " Jörg Sommer
@ 2023-09-20 22:41     ` Oliver Kiddle
  2023-09-23  7:16       ` Jörg Sommer
  0 siblings, 1 reply; 13+ messages in thread
From: Oliver Kiddle @ 2023-09-20 22:41 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: zsh-workers

Of these four patches, I've applied the two that seemed uncontroversial.

Of the other two is 51812 which adds a bunch more helpers. I'd have
thought that was fairly harmless. If anyone objects to too many very
similar functions, perhaps we can rework it to avoid the duplication.
And it'd be more useful to add these but get rid of the one for svk
given that svk is long dead.

The other was 51746 which did elicit a couple of less than enthusiastic
replies.

Oliver


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] run-help for docker, perf, podman, ssh, svnadmin
  2023-09-20 22:41     ` Oliver Kiddle
@ 2023-09-23  7:16       ` Jörg Sommer
  2023-09-23 15:57         ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: Jörg Sommer @ 2023-09-23  7:16 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

Oliver Kiddle schrieb am Do 21. Sep, 00:41 (+0200):
> The other was 51746 which did elicit a couple of less than enthusiastic
> replies.

I guess you talk about “run-help: Support variables in aliases”. This
discussion was entrenched and no solution was found. I still have the
problem of

```
% unalias run-help
% autoload run-help
% alias tt1='LC_ALL=C true' tt2=true
% run-help tt2
tt2 is an alias for true
% run-help tt1
tt1 is an alias for LC_ALL=C true
LC_ALL=C not found
No manual entry for LC_ALL=C
```


Regards Jörg


-- 
Unsere Zweifel sind Verräter und oft genug verspielen wir den möglichen
Gewinn, weil wir den Versuch nicht wagen.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 269 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] run-help for docker, perf, podman, ssh, svnadmin
  2023-09-23  7:16       ` Jörg Sommer
@ 2023-09-23 15:57         ` Bart Schaefer
  2023-09-24  7:31           ` Jörg Sommer
  0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2023-09-23 15:57 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: Oliver Kiddle, zsh-workers

On Sat, Sep 23, 2023 at 2:17 AM Jörg Sommer <joerg@jo-so.de> wrote:
>
> Oliver Kiddle schrieb am Do 21. Sep, 00:41 (+0200):
> > The other was 51746 which did elicit a couple of less than enthusiastic
> > replies.
>
> I guess you talk about “run-help: Support variables in aliases”. This
> discussion was entrenched and no solution was found.

Returning to that below ... meanwhile:

> I still have the
> problem of
>
> ```
> % unalias run-help
> % autoload run-help
> % alias tt1='LC_ALL=C true' tt2=true
> % run-help tt2
> tt2 is an alias for true
> % run-help tt1
> tt1 is an alias for LC_ALL=C true
> LC_ALL=C not found
> No manual entry for LC_ALL=C
> ```

This works for me in the current dev version, that is, after
workers/51593 is applied.

What continues not to work is your original example of an alias that
invokes another alias, where the first alias is nothing but an
assignment:

> zenbook% alias LCC='LC_ALL=C'; alias T='LCC true'
> zenbook% run-help T
> No manual entry for T
> ```

(the above excerpted from the message quoted below)

On Thu, 18 May 2023 08:52:21 +0200 Jörg Sommer <joerg@jo-so.de> wrote:
>
> Bart Schaefer schrieb am Wed 17. May, 15:45 (-0700):
> >                 # Discard the command itself & everything before it.
> >
> > so I would have expected the existing recursive call to cover it.  If
> > recursion is NOT handling it, then maybe we need to pull that whole
> > thing up to before the original "whence" command?

I'm leaning toward this being the way to go.  However, in retrospect,
Marlon's trick for skipping leading assignments, etc., begins to look
more ad-hoc than necessary.  I suspect we should instead disassemble
the command with ${(z)...} and look at the arguments one by one.

> zenbook% alias LCC='LC_ALL=C'; alias T='LCC true'

This is going to be a messy problem either way because this looks like
a command named "LCC" that happens to take an argument "true".  The
only way for run-help to discover that it should be invoking help for
"true" is to recursively expand all aliases before analyzing the
command line ... but in that case it can't report "... is an alias for
...".  I would more likely expect this --

> zenbook% run-help T

-- to at best respond with something like --

T is an alias for LCC true
LCC is an alias for LC_ALL=C

-- and then stop.

> > I repeat my earlier remarks about "reaching the point of diminishing
> > returns" with our attempts to turn run-help into a full command-line
> > parser.
>
> I see. That's a fair point. What would be a better attempt to support
> variables in aliases?

To start with, an additional flag to ${(Z+opts+)var} that would expand
aliases could be very helpful.  Other than that, the suggestion above
to use (z) or one of it's variations (do we handle both possible
settings of interactivecomments?) might make it easier to search for
command words.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] run-help for docker, perf, podman, ssh, svnadmin
  2023-09-23 15:57         ` Bart Schaefer
@ 2023-09-24  7:31           ` Jörg Sommer
  0 siblings, 0 replies; 13+ messages in thread
From: Jörg Sommer @ 2023-09-24  7:31 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Oliver Kiddle, zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1598 bytes --]

Bart Schaefer schrieb am Sa 23. Sep, 10:57 (-0500):
> On Sat, Sep 23, 2023 at 2:17 AM Jörg Sommer <joerg@jo-so.de> wrote:
> >
> > Oliver Kiddle schrieb am Do 21. Sep, 00:41 (+0200):
> > > The other was 51746 which did elicit a couple of less than enthusiastic
> > > replies.
> >
> > I guess you talk about “run-help: Support variables in aliases”. This
> > discussion was entrenched and no solution was found.
> 
> Returning to that below ... meanwhile:
> 
> > I still have the
> > problem of
> >
> > ```
> > % unalias run-help
> > % autoload run-help
> > % alias tt1='LC_ALL=C true' tt2=true
> > % run-help tt2
> > tt2 is an alias for true
> > % run-help tt1
> > tt1 is an alias for LC_ALL=C true
> > LC_ALL=C not found
> > No manual entry for LC_ALL=C
> > ```
> 
> This works for me in the current dev version, that is, after
> workers/51593 is applied.

This would be sufficient for me, because I can substitute the variable
assignment in the alias definition.

> What continues not to work is your original example of an alias that
> invokes another alias, where the first alias is nothing but an assignment:
> 
> > zenbook% alias LCC='LC_ALL=C'; alias T='LCC true'
> > zenbook% run-help T
> > No manual entry for T
> > ```

The alias LCC I use mostly interactively and put it in all other alias
definitions only for convenience. But in the zshrc I can use a variable
which expands on definition.


Regards Jörg

-- 
chinesiches Sprichwort:
Wer fragt, ist ein Narr für fünf Minuten.
Wer nicht fragt, ist ein Narr fürs ganze Leben.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 269 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-09-24  7:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 22:12 [PATCH 1/4] run-help: Support variables in aliases Jörg Sommer
2023-05-17 22:12 ` [PATCH 2/4] run-help-ip: Reduce the match for link to l Jörg Sommer
2023-05-17 22:12 ` [PATCH 3/4] run-help-openssl: Reduce the code Jörg Sommer
2023-05-17 22:12 ` [PATCH 4/4] run-help for docker, perf, podman, ssh, svnadmin Jörg Sommer
2023-05-31 17:45   ` [PATCH v2] " Jörg Sommer
2023-09-20 22:41     ` Oliver Kiddle
2023-09-23  7:16       ` Jörg Sommer
2023-09-23 15:57         ` Bart Schaefer
2023-09-24  7:31           ` Jörg Sommer
2023-05-17 22:45 ` [PATCH 1/4] run-help: Support variables in aliases Bart Schaefer
2023-05-18  6:52   ` Jörg Sommer
2023-05-18  9:02   ` Peter Stephenson
2023-05-23 16:25 ` [PATCH v2] run-help-openssl: Reduce code and use new manpages Jörg Sommer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).