From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2294 invoked by alias); 2 Mar 2018 12:16:44 -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: 23197 Received: (qmail 523 invoked by uid 1010); 2 Mar 2018 12:16:44 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f41.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.213.41):SA:0(-1.9/5.0):. Processed in 8.663514 secs); 02 Mar 2018 12:16:44 -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=zVBwguUenlvxQBfdWEhlBKm4aGuugOrNihGPa912stw=; b=ER48WR9jxt79H/+qRIRFbGKlcYCY7NwU5bydpUbPgppp3POpok0JRvQuyq4LlT2HTp hfo9OEVRkR1prm8zLynXdGQHpk+K+PbbQD9TybiC5Gq5qU3dZL5GyPowkRuawn1rrA12 /qtbjVKMIc+DBTjIBNXW6D6tyJAazfepkfbooK8AlAeOkyxM97j/6xPrOcyQk8RwOehp za7KAOzGixMLX9AflVuxBZuj0mWwSkox6Ly7p+v09ANNlGotRpzAmKVO4CVj+t5MLD0f ETRXcqSuTCLoBAy01CRkAz1U9qZYqzHLhGMJrx6RQG8DBceJrwo6mPzfJq9WVr2qEnQW bWkg== 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=zVBwguUenlvxQBfdWEhlBKm4aGuugOrNihGPa912stw=; b=XZ3YueWdGb+70ZD1jLqkqTF29fEifJI7lo2rzemzfOVmlZIgnq4BLG9LyRvGbCWg1Q jGfe8nz0sDKfxqE3zDKC97KYB4rclFKVh1L4o5hirQKqfo/3YSruYT1WZoqQcwl4Ol14 aDMIeleMr6awG3pOYCPAc0el7HSNT68G8iJH64/lyD7rJK6yVk4QeXrYgAX5bsX8PfAq 2paie9lyrybPuPPWEylyyKgFrYNeS1cGpoeWiWr83YOeLKWp4d2OCOyZSS0Q/65BFy/g vjfeGbOgrkXJT3X89F0ilcjEGzH2pJlpv+Oys10TPILBhGoACLhQGMBLCuDZwHG5ZZBe ggkQ== X-Gm-Message-State: APf1xPDJyKcvtUSFuOx6ICbLGFwYPRx7Z7NiPOk90Qjxi7V76SGvV1rO A98GskIDlp9SjDJnEUjth0x4UooEtHntbIaGHLQ= X-Google-Smtp-Source: AG47ELt/0T/aLaLhTEcpNTz4zYYmojXQCvzYivp9CkPML9EFsLzlJTDSZcFH63KLoKaPa/iNTUYoo26C6yRDSjJ9KV0= X-Received: by 10.31.128.84 with SMTP id b81mr3494530vkd.173.1519992992052; Fri, 02 Mar 2018 04:16:32 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <9b7ec742-8786-452b-26b7-c064d855f7c2@googlemail.com> References: <9b7ec742-8786-452b-26b7-c064d855f7c2@googlemail.com> From: Pier Paolo Grassi Date: Fri, 2 Mar 2018 13:15:51 +0100 Message-ID: Subject: Re: alias of completion To: m0viefreak Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="001a11429d745a3a7905666cf2a5" --001a11429d745a3a7905666cf2a5 Content-Type: text/plain; charset="UTF-8" YES that does it! thank you! I knew it must have to be very simple, I just was missing some information.. 2018-03-02 13:08 GMT+01:00 m0viefreak : > > > On 02.03.2018 10:31, Pier Paolo Grassi wrote: > > Hello guys, I just joined the list but I have been a zsh enthusiast for > 15 > > years and since I discovered it it's always been the best work > enviroment I > > ever had. > > 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. > > > > -what I tried- > > > > I know that the completion function for the docker command is _docker, > and > > that I could associate my function to this completion function with > > > > compdef _docker mydockerwrapper > > > > but it doesn't seem possibile to pass one default argument to the > > completion function in this way. > > > > So I tried defining my own completion function, and add one argument and > > pass it to the _docker function, but I got stuck on this one. > > > > I'm sure this must be very easy to do in zsh, I just can't figure out > how.. > > maybe someone can help me out? > > > > thanks, happy coding everyone! > > > > > > You could modify CURRENT and words in a custom completion function and > then just call _normal ("docker ls" is one word more than > "mydockerwrapper"): > > _mydockerwrapper() { > ((CURRENT++)) > words=(docker ls "${words[@]:1}") > _normal > } > compdef _mydockerwrapper mydockerwrapper > > -- 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 --001a11429d745a3a7905666cf2a5--