Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

safe completion functions



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@xxxxxxxxx)
http://www.borho.org/~steve/steve.asc
Key fingerprint = 2D08 E7CF B624 624C DE1F  E2E4 B0C2 5292 F2C6 2C8C

Attachment: pgpOfuX8XHy5N.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author