1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

Use explorer.exe as file manager if available

This commit is contained in:
Tarik02 2019-07-15 18:12:14 +03:00
parent 06e082c918
commit b4a5fa9615
3 changed files with 49 additions and 37 deletions

View File

@ -96,20 +96,24 @@ jo() {
output="$(autojump ${@})" output="$(autojump ${@})"
if [[ -d "${output}" ]]; then if [[ -d "${output}" ]]; then
case ${OSTYPE} in if command -v explorer.exe >/dev/null 2>&1; then
linux*) explorer.exe "${output}"
xdg-open "${output}" else
;; case ${OSTYPE} in
darwin*) linux*)
open "${output}" xdg-open "${output}"
;; ;;
cygwin) darwin*)
cygstart "" $(cygpath -w -a ${output}) open "${output}"
;; ;;
*) cygwin)
echo "Unknown operating system: ${OSTYPE}." 1>&2 cygstart "" $(cygpath -w -a ${output})
;; ;;
esac *)
echo "Unknown operating system: ${OSTYPE}." 1>&2
;;
esac
fi
else else
echo "autojump: directory '${@}' not found" echo "autojump: directory '${@}' not found"
echo "\n${output}\n" echo "\n${output}\n"

View File

@ -83,15 +83,19 @@ end
function jo function jo
set -l output (autojump $argv) set -l output (autojump $argv)
if test -d "$output" if test -d "$output"
switch $OSTYPE if command --search explorer.exe >/dev/null 2>&1 do
case 'linux*' explorer.exe (autojump $argv)
xdg-open (autojump $argv) else
case 'darwin*' switch $OSTYPE
open (autojump $argv) case 'linux*'
case cygwin xdg-open (autojump $argv)
cygstart "" (cygpath -w -a (pwd)) case 'darwin*'
case '*' open (autojump $argv)
__aj_err "Unknown operating system: \"$OSTYPE\"" case cygwin
cygstart "" (cygpath -w -a (pwd))
case '*'
__aj_err "Unknown operating system: \"$OSTYPE\""
end
end end
else else
__aj_err "autojump: directory '"$argv"' not found" __aj_err "autojump: directory '"$argv"' not found"

View File

@ -91,20 +91,24 @@ jo() {
setopt localoptions noautonamedirs setopt localoptions noautonamedirs
local output="$(autojump ${@})" local output="$(autojump ${@})"
if [[ -d "${output}" ]]; then if [[ -d "${output}" ]]; then
case ${OSTYPE} in if command -v explorer.exe >/dev/null 2>&1; then
linux*) explorer.exe "${output}"
xdg-open "${output}" else
;; case ${OSTYPE} in
darwin*) linux*)
open "${output}" xdg-open "${output}"
;; ;;
cygwin) darwin*)
cygstart "" $(cygpath -w -a ${output}) open "${output}"
;; ;;
*) cygwin)
echo "Unknown operating system: ${OSTYPE}" 1>&2 cygstart "" $(cygpath -w -a ${output})
;; ;;
esac *)
echo "Unknown operating system: ${OSTYPE}" 1>&2
;;
esac
fi
else else
echo "autojump: directory '${@}' not found" echo "autojump: directory '${@}' not found"
echo "\n${output}\n" echo "\n${output}\n"