zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: complete as some other sub command
Date: Mon, 4 Nov 2024 16:59:48 +0000 (GMT)	[thread overview]
Message-ID: <1679858811.2827593.1730739588559@mail.virginmedia.com> (raw)
In-Reply-To: <CAP+y1xCzaXdfJFK2phezxUrEopVJkxHRXsF8icEE1SubowauWA@mail.gmail.com>

> On 04/11/2024 16:42 GMT Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> 
> 
> Hello, is it possible to make a function to inherit the completion contest of another sub command? in my case i would like to make the function gd complete as it was "git diff"

The simple way is

autoload -X _git   # fails if _git is already loaded, harmless
compdef _git-diff gd

Others may be able to think of gotchas requiring something a bit
more sophisticated.

pws


  reply	other threads:[~2024-11-04 17:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 16:42 Pier Paolo Grassi
2024-11-04 16:59 ` Peter Stephenson [this message]
2024-11-04 17:14   ` Bart Schaefer
2024-11-05 11:57     ` Pier Paolo Grassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1679858811.2827593.1730739588559@mail.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).