On Mon, Nov 4, 2024 at 8:59 AM Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> 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=("$words[@]") CURRENT=$CURRENT
+words[1]=("$@")
+(( CURRENT += $# - 1 ))
+_normal