diff mbox series

[bug#66171,v3] gnu: git: Install zsh completions and git-prompt.

Message ID 00b2291bb7eaa66b3f62ea4d94e44bf85ec62b51.1695927171.git.liliana.prikler@gmail.com
State New
Headers show
Series [bug#66171,v3] gnu: git: Install zsh completions and git-prompt. | expand

Commit Message

Liliana Marie Prikler Sept. 23, 2023, 7:43 p.m. UTC
* gnu/packages/version-control.scm (git)[#:phases]<install-shell-completion>:
Also install git-prompt and zsh _git site function.
---
 gnu/packages/version-control.scm | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)


base-commit: ce0cc6137df81919389f61671096a6ce701c0889
prerequisite-patch-id: ee5d7299c5790d77e0d409f34165063fcff10a8b
prerequisite-patch-id: 369548fa905a48e7e2164ca4b6c9897e392a5025
prerequisite-patch-id: 7650e691c505ecc63e3b1a1265b3cb3a2869443e
prerequisite-patch-id: 5e7e47f338fa42c4f5c654a803f062b5e3f757a6

Comments

Maxim Cournoyer Oct. 2, 2023, 3:34 a.m. UTC | #1
Hi Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> * gnu/packages/version-control.scm (git)[#:phases]<install-shell-completion>:
> Also install git-prompt and zsh _git site function.
> ---
>  gnu/packages/version-control.scm | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
> index 9716a6f27a..d8c9bf4009 100644
> --- a/gnu/packages/version-control.scm
> +++ b/gnu/packages/version-control.scm
> @@ -448,12 +448,17 @@ (define-public git
>                       "DOCBOOK2X_TEXI=docbook2texi" "PERL_PATH=perl")))
>           (add-after 'install 'install-shell-completion
>             (lambda* (#:key outputs #:allow-other-keys)
> -             (let* ((out         (assoc-ref outputs "out"))
> -                    (completions (string-append out "/etc/bash_completion.d")))
> -               ;; TODO: Install the tcsh and zsh completions in the right place.
> -               (mkdir-p completions)
> +             (let* ((out  (assoc-ref outputs "out"))
> +                    (bash (string-append out "/etc/bash_completion.d"))
> +                    (zsh  (string-append out "/share/zsh/site-functions")))
> +               ;; TODO: Install the tcsh completions in the right place.
> +               (for-each mkdir-p (list bash zsh))
>                 (copy-file "contrib/completion/git-completion.bash"
> -                          (string-append completions "/git")))))
> +                          (string-append bash "/git"))
> +               (copy-file "contrib/completion/git-prompt.sh"
> +                          (string-append out "/bin/git-prompt"))
> +               (copy-file "contrib/completion/git-completion.zsh"
> +                          (string-append zsh "/_git")))))
>           (add-after 'install 'install-credential-netrc
>             (lambda* (#:key outputs #:allow-other-keys)
>               (let* ((netrc (assoc-ref outputs "credential-netrc")))

Sorry if my previous reply was not clear, but with your clarifications I
think it'd be best to keep the 'contrib' output, perhaps documenting in
the description that it contains the 'git-prompt' command as well as
completions for Zsh?
Liliana Marie Prikler Oct. 2, 2023, 4:30 a.m. UTC | #2
Am Sonntag, dem 01.10.2023 um 23:34 -0400 schrieb Maxim Cournoyer:
> Hi Liliana,
> 
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > [...]
> Sorry if my previous reply was not clear, but with your
> clarifications I think it'd be best to keep the 'contrib' output,
> perhaps documenting in the description that it contains the 'git-
> prompt' command as well as completions for Zsh?
IMHO, a ‘contrib’ output would be silly, since so much of what we
install in other outputs are part of contrib.  The name lacks meaning.

As for why I put it in ‘out’ instead of ‘completion’, I did miss the
fact that we already install git completions for bash, so not that I
know, I just extended the phase that does that.

Cheers
Efraim Flashner Oct. 2, 2023, 9:12 a.m. UTC | #3
On Mon, Oct 02, 2023 at 06:30:59AM +0200, Liliana Marie Prikler wrote:
> Am Sonntag, dem 01.10.2023 um 23:34 -0400 schrieb Maxim Cournoyer:
> > Hi Liliana,
> > 
> > Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> > 
> > > [...]
> > Sorry if my previous reply was not clear, but with your
> > clarifications I think it'd be best to keep the 'contrib' output,
> > perhaps documenting in the description that it contains the 'git-
> > prompt' command as well as completions for Zsh?
> IMHO, a ‘contrib’ output would be silly, since so much of what we
> install in other outputs are part of contrib.  The name lacks meaning.
> 
> As for why I put it in ‘out’ instead of ‘completion’, I did miss the
> fact that we already install git completions for bash, so not that I
> know, I just extended the phase that does that.

It's not uncommon to see shell completions in a contrib directory. I
think it'd make more sense to install them to a 'completions' output
than to a 'contrib' output, but I think it would make the most sense to
just install them to the 'out' output.
Maxim Cournoyer Oct. 4, 2023, 12:35 a.m. UTC | #4
Hi,

Efraim Flashner <efraim@flashner.co.il> writes:

> On Mon, Oct 02, 2023 at 06:30:59AM +0200, Liliana Marie Prikler wrote:
>> Am Sonntag, dem 01.10.2023 um 23:34 -0400 schrieb Maxim Cournoyer:
>> > Hi Liliana,
>> > 
>> > Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>> > 
>> > > [...]
>> > Sorry if my previous reply was not clear, but with your
>> > clarifications I think it'd be best to keep the 'contrib' output,
>> > perhaps documenting in the description that it contains the 'git-
>> > prompt' command as well as completions for Zsh?
>> IMHO, a ‘contrib’ output would be silly, since so much of what we
>> install in other outputs are part of contrib.  The name lacks meaning.
>> 
>> As for why I put it in ‘out’ instead of ‘completion’, I did miss the
>> fact that we already install git completions for bash, so not that I
>> know, I just extended the phase that does that.
>
> It's not uncommon to see shell completions in a contrib directory. I
> think it'd make more sense to install them to a 'completions' output
> than to a 'contrib' output, but I think it would make the most sense to
> just install them to the 'out' output.

Sounds good!
Maxim Cournoyer Oct. 10, 2023, 3:33 a.m. UTC | #5
Hello,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> * gnu/packages/version-control.scm (git)[#:phases]<install-shell-completion>:
> Also install git-prompt and zsh _git site function.

Applied to core-updates, after resolving the conflict.
diff mbox series

Patch

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 9716a6f27a..d8c9bf4009 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -448,12 +448,17 @@  (define-public git
                      "DOCBOOK2X_TEXI=docbook2texi" "PERL_PATH=perl")))
          (add-after 'install 'install-shell-completion
            (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out         (assoc-ref outputs "out"))
-                    (completions (string-append out "/etc/bash_completion.d")))
-               ;; TODO: Install the tcsh and zsh completions in the right place.
-               (mkdir-p completions)
+             (let* ((out  (assoc-ref outputs "out"))
+                    (bash (string-append out "/etc/bash_completion.d"))
+                    (zsh  (string-append out "/share/zsh/site-functions")))
+               ;; TODO: Install the tcsh completions in the right place.
+               (for-each mkdir-p (list bash zsh))
                (copy-file "contrib/completion/git-completion.bash"
-                          (string-append completions "/git")))))
+                          (string-append bash "/git"))
+               (copy-file "contrib/completion/git-prompt.sh"
+                          (string-append out "/bin/git-prompt"))
+               (copy-file "contrib/completion/git-completion.zsh"
+                          (string-append zsh "/_git")))))
          (add-after 'install 'install-credential-netrc
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((netrc (assoc-ref outputs "credential-netrc")))