Hi,

Firstly, I love fish. Just switched from bash and its f**king awesome. I've been trying to convert my bash_profile and I had a little function which went like:

  p() {
    cd "$PROJECTS/$1"
  }

  _p() {
COMPREPLY=( $(compgen -W "$(ls $PROJECTS | sort | grep -vE \"^_ \")" -- ${COMP_WORDS[COMP_CWORD]} ) )
  }

  complete -F _p p

I've been trying to write an equivalent in Fish. Here is the function:

  function p
    cd "$PROJECTS/$argv"
  end

I'm stuck on the completion. I think it should be something like this:

complete -c p -a "(__fish_complete_directories $PROJECTS/ (commandline -ct) \"Project\")"

However, that doesn't seem to work. I've had a look through the inbuilt completions but there doesn't seem to be any example which uses __fish_complete_directories in a fixed directory. I could just go the "ls | sort | grep ..." route, but that doesn't smell so "fishy".

Also, whenever I use the "p" function for the first time it chucks a sickie saying "test: !=: argument expected". I'm guessing that's just a Fish problem?

Any suggestions?

Cheers,

Chris Lloyd

--
chrislloyd.com.au

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to