zshrc/functions.d/_rdf
2011-09-27 23:32:35 +02:00

45 lines
1.1 KiB
Plaintext

#compdef rdf
_rdfshInputFile () {
local expl
_wanted files expl 'RDF File' _files -g '*.(#i)(rdf|n3|nt|owl|tt)(.)'
}
_rdfshResourceHistory () {
typeset -a rhistory
local resource
tail $HOME/.cache/rdf.sh/resource.history 2> /dev/null | tac | sed 's/:/\\\\:/' | while read resource
do
rhistory+=(${resource/ # [0-9]#:*})
done
_describe -t rhistory 'resource history' rhistory
}
_rdf() {
if [ "$CURRENT" -eq "2" ]
then
_describe -t command "RDF commands" "`rdf zshcomp`"
else
#_wanted files expl 'RDF Files' _files -g '*.(#i)(rdf|n3|owl|nt|xml|ttl)(.)'
_alternative 'files:RDF File:_rdfshInputFile' 'rhistory:resource history:_rdfshResourceHistory'
fi
#local cmd expl
#`rdf zshcomp`
#local args=(eins:Einmal zwei:ttt)
#_files -J "RDF files" -g '*.(#i)rdf.'
#_describe 'Argument' args
#_describe -t command "commands" args
#_description files expl 'RDF files'
#_files "$expl[@]" -g '*.(#i)(rdf|n3|owl|nt|xml)(.)'
#
#_arguments '-n[]' '-e[enable]'
#_arguments `rdf zshcomp`
#_arguments '-ntt[tt]' '-ett[enable]'
}
compdef _rdf rdf rdf.sh