From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 04F6620927 for ; Tue, 5 Nov 2024 12:59:43 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1730807983; b=nv61VsgcIVm0+OCLZYgGNs75Mv3njgGxy9kx/uI1Vk6OqOig+l93pqZ1IeDIzcAYmrxncazjAB 55guUOrAWwTA3POHiB5uL11J8pjlhdjuvBYOgFuMQzix9uFjWYYqsgY5/3Bo/pCdCLi5gjVc+R H1MXH6sUJzLUirJmrpi4lMtkSbYNOvWasXes3yF777N8H4r3SFwm9jQyGUcYE2JkxXb/XtSE2H sLYvMaBIYNYB4/mZh+gS4k+GuoT4/b+4bZVHEGqLQw+g8U42U9OdNtzlzP6k+yPTmta7F3babu aNRWtWk60ye2nkafk6iCfNBjLkvkAYy2JxqLgdo8/Q2tKg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yw1-f169.google.com) smtp.remote-ip=209.85.128.169; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1730807983; bh=ROEiptkUTfLYrg72hYpEl/4FYqE2Aulhi5hMP7uZqC0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=SkfFEzAKF2+fC4TNtc5gkQOBqeU6wZXhKSkJp2VZWLVy/bBAdSL0A5RF/IEBVpsjX1GhPBrjON /f+rBx1m9nswbFO8UJgR0lmzlRVVyoQX4HDERx36M5vuEUo2QrL5yWHMPFT+RADj15EhzeTwLj +iapvnqHPBAtXFBcz4qo/XvyDnRDvzihD/nHoOln3o7FQreRMwJLBSHiDM3jSmHqsBKmG2C406 OU+p0/tlqMGQGyyUX/BCq2JL61gxPzTW7mnYAm8lXxOLFU5hovMY4qpKtZic09kAb/zBSIGHcR TrquQUvtLJFNzsDYhD1gxnd2XU1U3lQWlP/FVsisewxztw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ROEiptkUTfLYrg72hYpEl/4FYqE2Aulhi5hMP7uZqC0=; b=l5HlLkI0LRkYLo+2KxvoT1HqVA R9V0n/5BiZ1lSI35kPsvNsgPfMT+S3Ngw+ARKOkTIEidAHCWOwIBD6XXoHUc2vf6XxMVAAxtThdeA rOsXI/jGBWTuNiVaqUIJXw9mICInDRN21hsEbnGFo6b8b+8HfyAf6+IXgNCnvuhOoyFhQDFQInEO8 Y+6ProCIBZggKPfR7Bb4Arpin/NL31T09g3RSIB51uSzvKIgyVOMqlfbvgFfjaL5qdQqlDt1RLpKq zVLMRTo8/gtS3DB4j26xYPA1i33WkMn4dvRMKUZ7yo+Ez1nTqELZ6oClTpj8+KrJ4td0MOc0krlVo eml/gnFw==; Received: by zero.zsh.org with local id 1t8IDn-000EaC-BK; Tue, 05 Nov 2024 11:59:43 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yw1-f169.google.com) smtp.remote-ip=209.85.128.169; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-yw1-f169.google.com ([209.85.128.169]:53748) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1t8ICg-000Dnz-MI; Tue, 05 Nov 2024 11:58:36 +0000 Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-6e377e4aea3so44227137b3.3 for ; Tue, 05 Nov 2024 03:58:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730807913; x=1731412713; darn=zsh.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ROEiptkUTfLYrg72hYpEl/4FYqE2Aulhi5hMP7uZqC0=; b=IzspehIqQ6NPbFi9lu6AUEjnrhHQBTLqITlUUZJ/1abSxshdjHnWkRSdYegghmFjSK wXieou3gQuDWTQCiJSr53p6gJDkqn3jaCY/9JK3ltzW2vRwME44OzCryHfoxrU7UjXW0 QIpDzg4Ogk4y61TMvW3zbllmXk2AoyumRDijt0Gkw9Z3EE++nWkXtB9l+u1PPl2wf+jW +kcnbn9cYFhry9S37kxtEiUx/bgJMK4rLEyRT4H7HgklJ6DRLSggOxXwQHMkJazglOVQ pnfBWBkI6LJG9v1qHsP1XThipZG5qgUajkH7UrdJ54tdylJOwsdfee3YjbUVJ7nQjw1J +Ldw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730807913; x=1731412713; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ROEiptkUTfLYrg72hYpEl/4FYqE2Aulhi5hMP7uZqC0=; b=TYKgD5DjVLomkTDP3a7gTi3ITeGO0qP1NGq8PUr/GhJl/SHOSv3CoEITU5ScSahUCc tdDVqfmir4MiWdgqNXmfmcY+hUy/JnYNsahZWMzdNtpTkG+4UaTF9zyx9RDN4H+tfcYD kJua2e9iszjNqQ9x/moS6+8e3m/HB+alBYnZaPOqF6jpDmoG3QX4xfdGy/q/EGWfv5ih 8vCkNuKp1O1Euby1sHMGjPOg45KflpiIzp8UZGtZ6CkHCsn8nduLkc8E7u99tHBI5K5B iZOTKw+cmHpaTCdh9VO4EMFvtsbcQ6lBdD7pW4ksS/CXoorlcXdSMSdB/9RT9SRR0c5N 7hCg== X-Gm-Message-State: AOJu0YxklAu5ErgMZ2oWXSq4uaTvV/drkZTQp22xhWXrl1JenmXtjJOk DUGP8u1XbTrI2BE+hS9oxluK2AFpda9cLNiopGRqv+lI945f2nr1WtHvH6QL2v3QZWCODdNGY/E qxHcML1HtveKkos4NHTvl7d8kXrA= X-Google-Smtp-Source: AGHT+IH/gJMJmFYjQVw0AsQPjxp7/AsDUFq6q63i04xZTw5JAKA6oo2KnKxvn3v4/ogXqw0NCPwPff2mKMfLmjWd2rk= X-Received: by 2002:a05:690c:708d:b0:6ea:2ac4:9df6 with SMTP id 00721157ae682-6ea64ab2f86mr161651257b3.3.1730807913316; Tue, 05 Nov 2024 03:58:33 -0800 (PST) MIME-Version: 1.0 References: <1679858811.2827593.1730739588559@mail.virginmedia.com> In-Reply-To: From: Pier Paolo Grassi Date: Tue, 5 Nov 2024 12:57:55 +0100 Message-ID: Subject: Re: complete as some other sub command To: Bart Schaefer Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="000000000000d907020626291ec3" X-Seq: 30097 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --000000000000d907020626291ec3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable that worked, thanks Pier Paolo Grassi Il giorno lun 4 nov 2024 alle ore 18:15 Bart Schaefer < schaefer@brasslantern.com> ha scritto: > On Mon, Nov 4, 2024 at 8:59=E2=80=AFAM Peter Stephenson > wrote: > > > > Others may be able to think of gotchas requiring something a bit > > more sophisticated. > > There's the "as if" function posted a few days ago to zsh-workers -- > haven't tried it myself. > > compdef '_as_if git diff' gd > > diff --git a/Completion/Base/Utility/_as_if > b/Completion/Base/Utility/_as_if > new file mode 100644 > index 000000000..84777ee32 > --- /dev/null > +++ b/Completion/Base/Utility/_as_if > @@ -0,0 +1,6 @@ > +#autoload > + > +local words=3D("$words[@]") CURRENT=3D$CURRENT > +words[1]=3D("$@") > +(( CURRENT +=3D $# - 1 )) > +_normal > > --000000000000d907020626291ec3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
that worked, thanks

Pier Paolo Gras= si


Il giorno lun 4 nov 202= 4 alle ore 18:15 Bart Schaefer <schaefer@brasslantern.com> ha scritto:
On Mon, Nov 4, 2024 at 8:59=E2=80=AFAM P= eter Stephenson
<p.w.st= ephenson@ntlworld.com> wrote:
>
> Others may be able to think of gotchas requiring something a bit
> more sophisticated.

There's the "as if" function posted a few days ago to zsh-wor= kers --
haven't tried it myself.

compdef '_as_if git diff' gd

diff --git a/Completion/Base/Utility/_as_if b/Completion/Base/Utility/_as_i= f
new file mode 100644
index 000000000..84777ee32
--- /dev/null
+++ b/Completion/Base/Utility/_as_if
@@ -0,0 +1,6 @@
+#autoload
+
+local words=3D("$words[@]") CURRENT=3D$CURRENT
+words[1]=3D("$@")
+(( CURRENT +=3D $# - 1 ))
+_normal

--000000000000d907020626291ec3--