zsh-users
 help / color / mirror / code / Atom feed
From: "Pavel S. Mazurin" <kovpas@gmail.com>
To: zsh-users@zsh.org
Subject: _files conditional custom separator
Date: Fri, 30 Nov 2018 19:47:00 +0100	[thread overview]
Message-ID: <CAFBR3VysE5v8gVaoMM+X91=xSeV1dHYZXSuEJredADgHB77bJw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

I'm trying to create a completion script for buck
<https://github.com/facebook/buck>. In essence, I want to be able to
complete the following format:

buck //path/to/my/buck/file:TargetName

I managed to make completion work for the most part: I can complete
everything up to the TargetName:

buck //path/to/my/buck/file/

with the following script:

if compset -P '//'; then
  _files -/
fi

The problem is that _files adds this / in the end of the path. However, I
want to have a check: if the path contains a BUCK file, I want this slash
to be replaced with a colon:

buck //path/to/my/buck/file:

Is there any way to achieve this?

-Pavel

                 reply	other threads:[~2018-11-30 18:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFBR3VysE5v8gVaoMM+X91=xSeV1dHYZXSuEJredADgHB77bJw@mail.gmail.com' \
    --to=kovpas@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).