Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
completion as if.
- X-seq: zsh-workers 53173
- From: Eric Cook <llua@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: completion as if.
- Date: Wed, 30 Oct 2024 16:21:12 -0400
- Archived-at: <https://zsh.org/workers/53173>
- List-id: <zsh-workers.zsh.org>
- Ui-outboundreport: notjunk:1;M01:P0:xSDKNhVKk2k=;AIERpjoOiDj/HamvSfCm1axCuh0 B/SsqdBOjqVPYhJg84z3UxhmNGlBgaLBONtyOOZpFVz0e0RxJbWBBzxKpBRaDyQU5XHLdbnuQ LXWnoOx8urF+ak7lJpTIWiSAvJn2Cobam5m37Hm5jETCZ+dZBOUKgOfwTQubuPkbDfK6dfOwN JMcV5zZ4tZOp4LBsQlV1evpZLbTOxT0UFjbqXxQSBRU40ouWHZhFNoOdYLaa0dUpWvrTTbcgu 5o+uxOevyJUgdbTVov5BV61PHUGQiYmbhWoGTjC5ZHOZry/P0FBGnuzhSSgkH9JtsbTRa9ZAq bvhVvtahVRaVgwHrTKpCW3sjD+PTId296ETDlv6udM1KopYqFvJxHopgAOv0cr9L5v0zvkp78 6DbgYQPnrn6NfYylFKCSRPUphfh8g62e4SkYPlyEBfaVA3zC4/wffBseNxKZXZFxKxr9OQAnb XDoMpo1OPaa5QzAbdofvFsZJNRWylawkXO4VHuxEX4UdbSyxYGW1CzTR05uCcZv5duFTmw4Qs fDq8khN6m+jsgDfeELcJXtowmDNjVvgB0z/aDi52Sc7FTHD9mdGH8JN7PxiNRQHGcKVsKqgny 8N1lxX/GaX2T14g114PWX9vUGGciTYLSvKFE7iVU6SCF9y2F3KbHav2W6RBaZf806Jou/m1hY aJX3XajGKEgYIrMulJFsGMM6D0cnRUBaAFA3T4UHo8EDApr0kpzYVk7KsUCbYNo4jGBlTFp9q IaxEevcDxTe2r0buPmWBi82oQNv42o8qfma3U/ArR5ONZFFRMiQx8kuUTH7gsdN+FW0HWU8q7 ildxR8c+HsGbYndiOo6x1M2Q==
Hey,
For years now people have come to irc and asked a question along the lines of
`how can i get my command to complete like this other command?' and over time
the given answer became to mess with the $words and $CURRENT (and times $service)
parameters before calling the completer that has the desired completion.
_othercommand() { words[1]=(docker run); (( CURRENT++ )); _docker }
compdef _othercommand othercommand
at some point noticing that the _normal function also works at tricking
compsys into doing so.
matthew martin floated the idea of shipping a function with zsh to easily
facilitate this, with something like:
#autoload
local service=$1 words=("$words[@]") CURRENT=$CURRENT
words[1]=("$@")
(( CURRENT += $# - 1 ))
_normal
Does anyone (in particular oliver) see a problem with this approach or
including a potential function with zsh?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author