zshrc/functions.d/_rdf

56 lines
1.5 KiB
Plaintext
Raw Normal View History

#compdef rdf
_rdfshInputFile () {
local expl
_wanted files expl 'RDF File' _files -g '*.(#i)(rdf|n3|nt|owl|tt)(.)'
}
_rdfshResourceHistory () {
typeset -a rhistory
local hresource
tail ~/.resource_history 2> /dev/null | sed 's/:/\\\\:/' | while read hresource
do
rhistory+=(${hresource/ # [0-9]#:*})
done
_describe -t rhistory 'resource history' rhistory
}
_rdfshCatchedResources () {
typeset -a rlist
local cresource
rdf list $words[$CURRENT] | sed 's/:/\\\\:/' | while read cresource
do
rlist+=(${cresource/ # [0-9]#:*})
done
_describe -t rlist 'catched resource list' rlist
}
_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'
#_alternative 'files:RDF File:_rdfshInputFile' 'rhistory:resource history:_rdfshResourceHistory' 'rlist:catched resource list:_rdfshCatchedResources'
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