mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-27 03:05:39 +01:00
adding hxKraut's haxe and haxelib zsh plug-in and auto-completion
This commit is contained in:
parent
96e4e5dd03
commit
91c5599fd7
3 changed files with 165 additions and 0 deletions
23
plugins/haxe/_haxe
Normal file
23
plugins/haxe/_haxe
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#compdef haxe
|
||||||
|
#autoload
|
||||||
|
|
||||||
|
_arguments -C \
|
||||||
|
'1::Haxe ML buildfile:_path_files -/ -g "*.hxml"' \
|
||||||
|
'(-cp)-cp[add a classpath]:enter the classpath:_path_files -/' \
|
||||||
|
'(-swf -js -neko -php -cpp -as3 -cs -java)-js[compile to javascript]:enter the destination file:_path_files -/ -g "*.js"' \
|
||||||
|
'(-swf -js -neko -php -cpp -as3 -cs -java)-swf[compile to a swf]:enter the destination file:_path_files -/ -g "*.swf"' \
|
||||||
|
'(-swf -js -neko -php -cpp -as3 -cs -java)-as3[compile to actionscript]:enter the destination directory:_path_files -/' \
|
||||||
|
'(-swf -js -neko -php -cpp -as3 -cs -java)-neko[compile to neko binary]:enter the destination file:_path_files -/ -g "*.n"' \
|
||||||
|
'(-swf -js -neko -php -cpp -as3 -cs -java)-php[compile to php]:enter the destination directory:_path_files -/' \
|
||||||
|
'(-swf -js -neko -php -cpp -as3 -cs -java)-cpp[compile to C++]:enter the destination directory:_path_files -/' \
|
||||||
|
'(-swf -js -neko -php -cpp -as3 -cs -java)-cs[compile to C#]:enter the destination directory:_path_files -/' \
|
||||||
|
'(-swf -js -neko -php -cpp -as3 -cs -java)-java[compile to Java]:enter the destination directory:_path_files -/' \
|
||||||
|
'(-xml)-xml[generate xml types description]:output file:_path_files -/ -g "*.xml"' \
|
||||||
|
'(-main)-main[startup class]' \
|
||||||
|
'-lib[additional libraries]' \
|
||||||
|
'-D[compilation flag]' \
|
||||||
|
'(-v)-v[verbose mode]' \
|
||||||
|
'(-debug)-debug[compile with debugging symbols]' \
|
||||||
|
'(-help --help)'{-help,--help}'[shows list of available commands]'
|
||||||
|
|
||||||
|
return 0
|
||||||
129
plugins/haxe/_haxelib
Normal file
129
plugins/haxe/_haxelib
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
#compdef haxelib
|
||||||
|
#autoload
|
||||||
|
|
||||||
|
zmodload zsh/regex
|
||||||
|
|
||||||
|
_haxelib() {
|
||||||
|
if (( CURRENT > 2 )); then
|
||||||
|
# Remember the subcommand name
|
||||||
|
local cmd=${words[2]}
|
||||||
|
# Set the context for the subcommand.
|
||||||
|
curcontext="${curcontext%:*:*}:haxelib-$cmd"
|
||||||
|
# Narrow the range of words we are looking at to exclude `haxelib´
|
||||||
|
(( CURRENT-- ))
|
||||||
|
shift words
|
||||||
|
case "$cmd" in
|
||||||
|
upgrade|selfupdate|register)
|
||||||
|
return 1;;
|
||||||
|
esac
|
||||||
|
# Run the completion for the subcommand
|
||||||
|
_haxelib_cmd_$cmd
|
||||||
|
else
|
||||||
|
local hline
|
||||||
|
local -a cmdlist
|
||||||
|
_call_program help-commands haxelib | while read -A hline; do
|
||||||
|
(( ${#hline} < 4 )) && continue
|
||||||
|
[[ $hline[1] = (#i)Haxe ]] && continue
|
||||||
|
[[ $hline[1] = (#i)Usage ]] && continue
|
||||||
|
[[ $hline[1] = (#i)commands ]] && continue
|
||||||
|
cmdlist=($cmdlist "${hline[1]}:${hline[3,-1]}")
|
||||||
|
done
|
||||||
|
_describe -t haxelib-commands "Haxelib command" cmdlist
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_local_libs() {
|
||||||
|
eval $'installed_libs=( ${(s.\n.)"$(haxelib list | cut -d ":" -f 1)"} )'
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_remote_libs() {
|
||||||
|
eval $'remote_libs=( ${(s.\n.)"%(zshcomplete remote)"} )'
|
||||||
|
}
|
||||||
|
|
||||||
|
local -a installed_libs
|
||||||
|
local -a remote_libs
|
||||||
|
|
||||||
|
_haxelib_cmd_install() {
|
||||||
|
_haxelib_remote_libs
|
||||||
|
_path_files -/ -g "*.hxml"
|
||||||
|
_wanted remote-libs expl '' compadd -x "Insufficient completion for haxelib-install, only hxml so far!" -a remote_libs
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_list() {
|
||||||
|
compadd -x "No completion so far for haxelib list"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_update() {
|
||||||
|
_haxelib_local_libs
|
||||||
|
_wanted installed-libs expl '' compadd -x "Matching haxe libraries" -a installed_libs
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_remove() {
|
||||||
|
_haxelib_local_libs
|
||||||
|
_wanted installed_libs expl '' compadd -x "Matching haxe libraries" -a installed_libs
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_set() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_search() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
_haxelib_cmd_info() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_user() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_submit() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_setup() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_convertxml() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_config() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_path() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_run() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_local() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_dev() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_git() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib_cmd_proxy() {
|
||||||
|
compadd -x "$cmd-completion not implemented!"
|
||||||
|
}
|
||||||
|
|
||||||
|
_haxelib "$@"
|
||||||
|
|
||||||
|
# _lib_remote() {
|
||||||
|
# local cache_file=/tmp/haxelib_remote~
|
||||||
|
# if [[ ! -f $cache_file(mh-1) ]]; then
|
||||||
|
# zshcomplete remote > "$cache_file"
|
||||||
|
# fi
|
||||||
|
# eval $'remote_libs=( ${(s.\n.)"$(cat $cache_file)"} )'
|
||||||
|
# }
|
||||||
13
plugins/haxe/haxe.plugin.zsh
Normal file
13
plugins/haxe/haxe.plugin.zsh
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
export HXCOMPLETEVERSION="0.1.0"
|
||||||
|
|
||||||
|
# Aliases
|
||||||
|
alias hl='haxelib'
|
||||||
|
compdef hl=haxelib
|
||||||
|
alias hli='haxelib install'
|
||||||
|
compdef _haxelib hli=haxelib-install
|
||||||
|
alias hlr='haxelib run'
|
||||||
|
compdef _haxelib hlr=haxelib-run
|
||||||
|
alias hll='haxelib list'
|
||||||
|
compdef _haxelib hll=haxelib-list
|
||||||
|
|
||||||
|
alias hlinvalidate='rm -f /tmp/haxelib_*' #invalidates completion cache.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue