| Server IP : 199.250.200.62 / Your IP : 216.73.217.89 Web Server : Apache System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : jasonp18 ( 1000) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/share/zsh/5.0.2/functions/ |
Upload File : |
#compdef open
_open_absolute_application_path() {
local expl curcontext
zstyle -T ":completion:${curcontext}:files" prefix-needed && \
[[ "$PREFIX" != [/~]* && compstate[nmatches] -ne 0 ]] && return 1
_wanted files expl 'application file' _path_files -P "$PREFIX[1]" -W /
}
_open() {
local curcontext="$curcontext" state line expl
_arguments -C \
'-a[specify application]: :->open_mac_applications' \
'-e[open with TextEdit]' \
'-f[reads input from standard input and opens with TextEdit]' \
'*: :->open_files'
case "$state" in
open_mac_applications)
_alternative \
"commands: :_mac_applications" \
"files:: _open_absolute_application_path"
;;
open_files)
local app
if [[ -n "$words[(r)-a]" ]]; then
app="${(Q)words[words[(i)-a] + 1]}"
elif [[ -n "$words[(r)-e]" || -n "$words[(r)-f]" ]]; then
app="Text Edit"
fi
if [[ -n "$app" ]]; then
_wanted files expl "file for $app" _mac_files_for_application "$app"
else
_webbrowser
fi
;;
esac
}
_open "$@"