I'm a mostly-OSX user, and I use it through SSH and Terminal a lot.

I wrote this completion for the "open -a" command, to launch
applications from the commandline.  I have an openapp function (open
-a $argv) that it's written for, but the completion has options that
you can comment out if you don't want that function.

I have a quitapp function that works through osascript, but want to
write a completion to find running apps first

Question: My completion doesn't seem to load automagically.  I have to
". ~/.config/fish/completions/openapp.fish"  Any idea why?

stevs...@lx9901033 ~> ls /Users/stevscot/.config/fish/completions/
openapp.fish
stevs...@lx9901033 ~> echo $fish_complete_path
/Users/stevscot/.config/fish/completions /sw/etc/fish/completions
/sw/share/fish/completions
stevs...@lx9901033 ~>


I attached my completion, I'll paste it in too (been a long time since
i used a SF mailing list)

------------------------
begin

# search Applications and Developer Apps
set dirs /Applications /Applications/Utilities /Developer/Applications
/Developer/Applications/Utilities

# just search main apps dir
#set dirs /Applications /Applications/Utilities

# do a quicker search
set search '(for dir in $dirs; ls $dir |grep \.app\$; ls $dir/* |grep
\.app\$; end)'

# exhaustive search, sloooooow
#set search "(find $dirs -type d -iname '*.app' -exec basename '{}' \\;)"

complete -c openapp -x -u -a $search

# if you don't have the openapp (open -a $argv) function
#complete -c open -u -s a -a $search

end
------------------------


--
Steven Scott

Attachment: openapp.fish
Description: Binary data

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to