mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
Merge pull request #366 from CodeMonk/master
Set OSTYPE correctly for fish wrapper.
This commit is contained in:
commit
ffe22e1838
@ -5,6 +5,11 @@ if test -d ~/.autojump
|
|||||||
set -x PATH ~/.autojump/bin $PATH
|
set -x PATH ~/.autojump/bin $PATH
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Set ostype, if not set
|
||||||
|
if not set -q OSTYPE
|
||||||
|
set -gx OSTYPE (bash -c 'echo ${OSTYPE}')
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# enable tab completion
|
# enable tab completion
|
||||||
complete -x -c j -a '(autojump --complete (commandline -t))'
|
complete -x -c j -a '(autojump --complete (commandline -t))'
|
||||||
@ -34,7 +39,7 @@ end
|
|||||||
# misc helper functions
|
# misc helper functions
|
||||||
function __aj_err
|
function __aj_err
|
||||||
# TODO(ting|#247): set error file location
|
# TODO(ting|#247): set error file location
|
||||||
echo $argv 1>&2; false
|
echo -e $argv 1>&2; false
|
||||||
end
|
end
|
||||||
|
|
||||||
# default autojump command
|
# default autojump command
|
||||||
@ -44,6 +49,10 @@ function j
|
|||||||
autojump $argv
|
autojump $argv
|
||||||
case '*'
|
case '*'
|
||||||
set -l output (autojump $argv)
|
set -l output (autojump $argv)
|
||||||
|
# Check for . and attempt a regular cd
|
||||||
|
if [ $output = "." ]
|
||||||
|
cd $argv
|
||||||
|
else
|
||||||
if test -d "$output"
|
if test -d "$output"
|
||||||
set_color red
|
set_color red
|
||||||
echo $output
|
echo $output
|
||||||
@ -56,6 +65,7 @@ function j
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# jump to child directory (subdirectory of current path)
|
# jump to child directory (subdirectory of current path)
|
||||||
@ -73,11 +83,7 @@ end
|
|||||||
function jo
|
function jo
|
||||||
set -l output (autojump $argv)
|
set -l output (autojump $argv)
|
||||||
if test -d "$output"
|
if test -d "$output"
|
||||||
__aj_err "autojump: directory '"$argv"' not found"
|
switch $OSTYPE
|
||||||
__aj_err "\n$output\n"
|
|
||||||
__aj_err "Try `autojump --help` for more information."
|
|
||||||
else
|
|
||||||
switch (sh -c 'echo ${OSTYPE}')
|
|
||||||
case 'linux*'
|
case 'linux*'
|
||||||
xdg-open (autojump $argv)
|
xdg-open (autojump $argv)
|
||||||
case 'darwin*'
|
case 'darwin*'
|
||||||
@ -85,9 +91,12 @@ function jo
|
|||||||
case cygwin
|
case cygwin
|
||||||
cygstart "" (cygpath -w -a (pwd))
|
cygstart "" (cygpath -w -a (pwd))
|
||||||
case '*'
|
case '*'
|
||||||
__aj_error "Unknown operating system: '"$OSTYPE"'"
|
__aj_error "Unknown operating system: \"$OSTYPE\""
|
||||||
end
|
end
|
||||||
echo end
|
else
|
||||||
|
__aj_err "autojump: directory '"$argv"' not found"
|
||||||
|
__aj_err "\n$output\n"
|
||||||
|
__aj_err "Try `autojump --help` for more information."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user