From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12936 invoked by alias); 2 Mar 2018 12:01:35 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23194 Received: (qmail 29061 invoked by uid 1010); 2 Mar 2018 12:01:35 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f181.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.217.181):SA:0(-1.9/5.0):. Processed in 4.572541 secs); 02 Mar 2018 12:01:35 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: pierpaolog@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sgw39JHzrCHa5dABQCJLrC4LfB+AKJfjHRKUbsyb5Hw=; b=pKYmQm94kn2GXCvU67QaA+oh59ieU2kXkkoCG+3g+avIFghRRr6tQBRKYS8VTv5rhd kMViprRV8s/jSUrGvL8AHwmleMZD1Tji5TkfnRDlWa95EhAoraewcDbF+xeNh9tojzK9 Fcr/vEhHCjpdKK584ThN/JzXMqvxLMPrBXBhTW30ydOtCcrtha7jYUhwcrf7kruZJq5Z Iz+uX/vEBRS1q7dBUmrEQHA9+STTTe7UlVCrf/+vOkexzV2QKRRsZCK7E1SUWIp0Ez5C 9gA5QciSLbP7CBYtwhkMRMr3jg8lJx/aeiWhWe8fc30Ssi62TpMdWrRuhrPDC1HD8K3b DpnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sgw39JHzrCHa5dABQCJLrC4LfB+AKJfjHRKUbsyb5Hw=; b=inWfsWT/H/Fjam/UvgoCNHgwljzCQDiSv86LtnTtPZ4ecTs9Kh+Eg1S9v99a1Iv1WO LxxU9T82ovX3+HZe2a3QhyAUiYI/SIkJc2nFVU5C3J5AShipLPVmH0ITMsZlYq116n4i SDICk8R3ZVcdl2crbpdKw3r+0tDafyd9ntTxF1pE9PPzAeEOSwcypdCIegAOxdU55gUB Yptk+xf1VDYbhZRhLcAR6pYKVABjah+9d6dBAO9RlAhjB60ZCBmXSzlzhGHuUN9uFAH7 XQj5VBjncLvm3pZ7C5IsYfmoACEmdeN0sz/rT9Hb14bMYIzr9gy2rcXxg1vLRXYiSYI2 Hg9A== X-Gm-Message-State: APf1xPACkMHIVMZzfo0MAbzKUJV/IhqAuXIWOn+O9lsZa0JoYn0d41d9 8w5MGh5OOXW5OV8j4EwCCpyOOL0JRPwjoufz2eI= X-Google-Smtp-Source: AG47ELugbixGx4LmNuHmJ2wMlK4yaOYtXx9QjOaV8Oa5kHaKfxitAi8voQFI14RK5P7P2xbJLFW4oD+tlgEXy5NkyyQ= X-Received: by 10.159.56.209 with SMTP id w17mr3733286uaf.108.1519992086991; Fri, 02 Mar 2018 04:01:26 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20180302105103.679c7880@camnpupstephen.cam.scsc.local> References: <20180302105103.679c7880@camnpupstephen.cam.scsc.local> From: Pier Paolo Grassi Date: Fri, 2 Mar 2018 13:00:46 +0100 Message-ID: Subject: Re: alias of completion To: Peter Stephenson Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="f403045f38de68178f05666cbc01" --f403045f38de68178f05666cbc01 Content-Type: text/plain; charset="UTF-8" Hello Peter, thank you for your suggestion. Following it I was able to write: compdef _docker xy=_docker_image_commands that kind of work for the first word, the problem is that the second word is not completed correctly since it tries again to use _docker_image_commands instead of whaterver it should have called. The only functions defined inside the file that /usr/share/zsh/vendor-completions/_docker match the word image are: __docker_complete_images __docker_complete_images_filters __docker_image_commands __docker_image_subcommand so there isn't a more general completion function like _docker_image that takes care of the completion for docker image [xx [yy]...], but there are various functions called from __docker_subcommand inspecting the array $words. What I would need, I think, is the ability to populate from another completion function this array adding as first argument the value "image", so that: compadd _docker mydockerwrapper=docker would make __docker_subcommand behave as if the command line contained not only "docker" but "docker image", something like: compadd _docker mydockerwrapper="docker image" that is obviously wrong because "docker image" it is not a correct service name, I wrote it just to illustrate my point 2018-03-02 11:51 GMT+01:00 Peter Stephenson : > From: Peter Stephenson > To: Pier Paolo Grassi > Cc: zsh-users@zsh.org > Subject: Re: alias of completion > Date: Fri, 2 Mar 2018 10:47:34 +0000 > X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) > Organization: SCSC > > On Fri, 2 Mar 2018 10:31:57 +0100 > Pier Paolo Grassi wrote: > > One thing I was never been able to accomplish though, is: what if I > > want a custom function, say: > > > > mydockerwrapper(){} > > > > behave, for completion's sake, like, let's say: > > > > docker ls > > > > so that if I try to complete after > > > > mydockerwrapper > > > > I get the same suggestion that I would get after docker ls, and if I > > have > > > > mydockerwrapper xx > > > > I get the same completion that I would get after docker ls xx, and > > so on. > > You need a bit of help from the completion function in > question to do this. The feature in question is "services": I just > looked at the docker completion and it does support this. > > You'll need to do something like > > compdef _docker mydockerwrapper=docker_service_complete_ls_filters > > where the thing on the right of the "=" is an appropriate docker > completion function without the "_" (search for _$service for the code > in _docker supporting this). > > pws > -- Pier Paolo Grassi email: pierpaolog@gmail.com linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217 fondatore: https://www.meetup.com/it-IT/Machine-Learning-TO --f403045f38de68178f05666cbc01--