2006-02-08 17:20:05 +08:00
|
|
|
#
|
|
|
|
# This allows us to use 'open FILENAME' to open a given file in the default
|
|
|
|
# application for the file.
|
|
|
|
#
|
|
|
|
|
|
|
|
if not test (uname) = Darwin
|
2007-01-16 09:29:18 +08:00
|
|
|
function open --description "Open file in default application"
|
2006-11-18 00:24:38 +08:00
|
|
|
if count $argv >/dev/null
|
|
|
|
switch $argv[1]
|
|
|
|
case -h --h --he --hel --help
|
2008-06-06 03:23:05 +08:00
|
|
|
__fish_print_help open
|
2006-11-18 00:24:38 +08:00
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-10 15:26:58 +08:00
|
|
|
if type -q -f cygstart
|
2013-08-13 22:21:40 +08:00
|
|
|
for i in $argv
|
|
|
|
cygstart $i
|
|
|
|
end
|
2014-07-10 15:26:58 +08:00
|
|
|
else if type -q -f xdg-open
|
2009-02-17 05:11:03 +08:00
|
|
|
for i in $argv
|
|
|
|
xdg-open $i
|
|
|
|
end
|
2006-10-12 00:17:49 +08:00
|
|
|
else
|
2015-07-20 09:00:31 +08:00
|
|
|
echo (_ 'No open utility found. Try installing "xdg-open" or "xdg-utils".')
|
2006-10-12 00:17:49 +08:00
|
|
|
end
|
2006-02-08 17:20:05 +08:00
|
|
|
end
|
|
|
|
end
|