zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 1/2] run-help: chain run-help-sudo to call run-help on the next argument
@ 2018-12-27 15:24 Samir Benmendil
  2018-12-27 15:24 ` [PATCH 2/2] run-help: add run-help-btrfs Samir Benmendil
  2020-12-09  9:05 ` [PATCH 1/2] run-help: chain run-help-sudo to call run-help on the next argument Jun T
  0 siblings, 2 replies; 6+ messages in thread
From: Samir Benmendil @ 2018-12-27 15:24 UTC (permalink / raw)
  To: zsh-workers; +Cc: Samir Benmendil

---
 Functions/Misc/run-help-sudo | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Functions/Misc/run-help-sudo b/Functions/Misc/run-help-sudo
index f38696e19..a8fa7aa0f 100644
--- a/Functions/Misc/run-help-sudo
+++ b/Functions/Misc/run-help-sudo
@@ -2,6 +2,6 @@
 if [ $# -eq 0 ]; then
     man sudo
 else
-    man $1
+    run-help $1
 fi
 
-- 
2.19.1


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

* [PATCH 2/2] run-help: add run-help-btrfs
  2018-12-27 15:24 [PATCH 1/2] run-help: chain run-help-sudo to call run-help on the next argument Samir Benmendil
@ 2018-12-27 15:24 ` Samir Benmendil
  2020-12-09  9:14   ` Jun T
  2020-12-09  9:05 ` [PATCH 1/2] run-help: chain run-help-sudo to call run-help on the next argument Jun T
  1 sibling, 1 reply; 6+ messages in thread
From: Samir Benmendil @ 2018-12-27 15:24 UTC (permalink / raw)
  To: zsh-workers; +Cc: Samir Benmendil

---
 Functions/Misc/run-help-btrfs | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Functions/Misc/run-help-btrfs

diff --git a/Functions/Misc/run-help-btrfs b/Functions/Misc/run-help-btrfs
new file mode 100644
index 000000000..d9e3530c1
--- /dev/null
+++ b/Functions/Misc/run-help-btrfs
@@ -0,0 +1,31 @@
+if [ $# -eq 0 ]; then
+    man btrfs
+    return
+fi
+
+while [[ $# != 0 && $1 == -* ]]; do
+    shift
+done
+
+case $1 in
+    (b*)    man btrfs-balance          ;;
+    (c*)    man btrfs-check            ;;
+    (d*)    man btrfs-device           ;;
+    (f*)    man btrfs-filesystem       ;;
+    (i*)    man btrfs-image            ;;
+    (i*)    man btrfs-inspect-internal ;;
+    (m*)    man btrfs-map-logical      ;;
+    (p*)    man btrfs-property         ;;
+    (q*)    man btrfs-qgroup           ;;
+    (q*)    man btrfs-quota            ;;
+    (rec*)  man btrfs-receive          ;;
+    (rep*)  man btrfs-replace          ;;
+    (resc*) man btrfs-rescue           ;;
+    (rest*) man btrfs-restore          ;;
+    (sc*)   man btrfs-scrub            ;;
+    (se*)   man btrfs-send             ;;
+    (su*)   man btrfs-subvolume        ;;
+    (*)     man btrfs                  ;;
+esac
+
+return $?
-- 
2.19.1


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

* Re: [PATCH 1/2] run-help: chain run-help-sudo to call run-help on the next argument
  2018-12-27 15:24 [PATCH 1/2] run-help: chain run-help-sudo to call run-help on the next argument Samir Benmendil
  2018-12-27 15:24 ` [PATCH 2/2] run-help: add run-help-btrfs Samir Benmendil
@ 2020-12-09  9:05 ` Jun T
  1 sibling, 0 replies; 6+ messages in thread
From: Jun T @ 2020-12-09  9:05 UTC (permalink / raw)
  To: zsh-workers

It seems we have missed two patches from Samir Benmendil.
(pointed out by Christian K, users/26216⁩)

> 2018/12/28 0:24, Samir Benmendil <me@rmz.io> wrote:
> 
> diff --git a/Functions/Misc/run-help-sudo b/Functions/Misc/run-help-sudo
> index f38696e19..a8fa7aa0f 100644
> --- a/Functions/Misc/run-help-sudo
> +++ b/Functions/Misc/run-help-sudo
> @@ -2,6 +2,6 @@
> if [ $# -eq 0 ]; then
>     man sudo
> else
> -    man $1
> +    run-help $1
> fi
> 

Can we assume that the function run-help is already loaded when run-help-sudo
is called? (I think yes, no one will use run-help-sudo without loading run-help).

If this is the case, I think the patch has no problem.

-----
Jun

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

* Re: [PATCH 2/2] run-help: add run-help-btrfs
  2018-12-27 15:24 ` [PATCH 2/2] run-help: add run-help-btrfs Samir Benmendil
@ 2020-12-09  9:14   ` Jun T
  2020-12-09 15:51     ` Christian K
  0 siblings, 1 reply; 6+ messages in thread
From: Jun T @ 2020-12-09  9:14 UTC (permalink / raw)
  To: zsh-workers; +Cc: syphdias

Another patch we missed.

> 2018/12/28 0:24, Samir Benmendil <me@rmz.io> wrote:
> 
> --- /dev/null
> +++ b/Functions/Misc/run-help-btrfs
(snip)
> +    (i*)    man btrfs-image            ;;

> +    (m*)    man btrfs-map-logical      ;;

These two are not subcommands of btrfs.

> +    (q*)    man btrfs-qgroup           ;;
> +    (q*)    man btrfs-quota            ;;

These two must be distinguished.



diff --git a/Functions/Misc/run-help-btrfs b/Functions/Misc/run-help-btrfs
new file mode 100644
index 000000000..0dc1dabcb
--- /dev/null
+++ b/Functions/Misc/run-help-btrfs
@@ -0,0 +1,22 @@
+while [[ $# != 0 && $1 == -* ]]; do
+    shift
+done
+
+case $1 in
+    (b*)    man btrfs-balance          ;;
+    (c*)    man btrfs-check            ;;
+    (d*)    man btrfs-device           ;;
+    (f*)    man btrfs-filesystem       ;;
+    (i*)    man btrfs-inspect-internal ;;
+    (p*)    man btrfs-property         ;;
+    (qg*)   man btrfs-qgroup           ;;
+    (qu*)   man btrfs-quota            ;;
+    (rec*)  man btrfs-receive          ;;
+    (rep*)  man btrfs-replace          ;;
+    (resc*) man btrfs-rescue           ;;
+    (rest*) man btrfs-restore          ;;
+    (sc*)   man btrfs-scrub            ;;
+    (se*)   man btrfs-send             ;;
+    (su*)   man btrfs-subvolume        ;;
+    (*)     man btrfs                  ;;
+esac


-----
Jun


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

* Re: [PATCH 2/2] run-help: add run-help-btrfs
  2020-12-09  9:14   ` Jun T
@ 2020-12-09 15:51     ` Christian K
  2020-12-11  6:08       ` Jun T
  0 siblings, 1 reply; 6+ messages in thread
From: Christian K @ 2020-12-09 15:51 UTC (permalink / raw)
  To: zsh-workers

> > --- /dev/null
> > +++ b/Functions/Misc/run-help-btrfs
> (snip)
> > +    (i*)    man btrfs-image            ;;
>
> > +    (m*)    man btrfs-map-logical      ;;
>
> These two are not subcommands of btrfs.
>
> > +    (q*)    man btrfs-qgroup           ;;
> > +    (q*)    man btrfs-quota            ;;
>
> These two must be distinguished.

I'm sure there were some changes to btrfs subcommands in the meantime.
As far as I can tell you can shorten all subcommands for btrfs as long
as they are unique. So I'd expect this would need to be updated once
in a while. So this way of doing it could lead to the wrong man page
being displayed but otherwise you wouldn't get the correct sub-man
page if you would run run-help on `btrfs files foo` for example.

Not an expert on btrfs I just stumbled on this while looking at some
btrfs issues.

Christian


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

* Re: [PATCH 2/2] run-help: add run-help-btrfs
  2020-12-09 15:51     ` Christian K
@ 2020-12-11  6:08       ` Jun T
  0 siblings, 0 replies; 6+ messages in thread
From: Jun T @ 2020-12-11  6:08 UTC (permalink / raw)
  To: zsh-workers; +Cc: Christian K


> 2020/12/10 0:51, Christian K <syphdias@gmail.com> wrote:
> 
> I'm sure there were some changes to btrfs subcommands in the meantime.

I believe the set of subcommands are quite stable in the case of btrfs
(btrfs-{image,map-logical} are independent commands).
But of course if subcommands are added/delteed we need to update
run-help-btrfs. Let us know if you notice any change.



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

end of thread, other threads:[~2020-12-11  6:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-27 15:24 [PATCH 1/2] run-help: chain run-help-sudo to call run-help on the next argument Samir Benmendil
2018-12-27 15:24 ` [PATCH 2/2] run-help: add run-help-btrfs Samir Benmendil
2020-12-09  9:14   ` Jun T
2020-12-09 15:51     ` Christian K
2020-12-11  6:08       ` Jun T
2020-12-09  9:05 ` [PATCH 1/2] run-help: chain run-help-sudo to call run-help on the next argument Jun T

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).