zsh-users
 help / color / mirror / code / Atom feed
From: Steve Borho <steve@borho.org>
To: zsh-users@sunsite.dk
Subject: safe completion functions
Date: Fri, 28 Oct 2005 12:14:38 -0500	[thread overview]
Message-ID: <200510281214.42804.steve@borho.org> (raw)

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

Hello everyone.

I'm trying to write a somewhat feature-full completion function for the new 
bazaar 2.0 (aka bzr) revision control system.

The bzr developers have recently added some command line functions that can 
list files with NULL terminators, just like find.  Unfortunately, I can't get 
the completion functions to work correctly.

my completion function for add looks like this (in a nutshell):

  (add)
       _arguments $helpArgs \
       '--no-recurse[do not recurse into subdirectories]' \
       '(-q)--quiet' \
       '(--quiet)-q' \
       '*:unknown files:_unknownFiles'
  ;;

_unknownFiles() {
    local fileList;
    fileList=($(bzr ls --null --unknown))
    compadd -af fileList
    return 0
}

When I test it, I get: this

% cd repo
% touch "foo bar" baz zed
% bzr add [TAB]
     bar  baz  foo  zed

It's somehow splitting "foo\ bar" into "foo",  " ",  "bar".  I seem to be 
missing something obvious.  Can anyone help?

-- 
Steve Borho (steve@borho.org)
http://www.borho.org/~steve/steve.asc
Key fingerprint = 2D08 E7CF B624 624C DE1F  E2E4 B0C2 5292 F2C6 2C8C

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2005-10-28 17:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-28 17:14 Steve Borho [this message]
2005-10-28 17:29 ` Clint Adams
2005-10-28 18:06   ` Steve Borho
2005-10-28 17:31 ` Andrey Borzenkov

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=200510281214.42804.steve@borho.org \
    --to=steve@borho.org \
    --cc=zsh-users@sunsite.dk \
    /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).