new compdefs
This commit is contained in:
parent
0b666d1cf6
commit
58cc14e1aa
8
compdef/_mediathek
Normal file
8
compdef/_mediathek
Normal file
|
@ -0,0 +1,8 @@
|
|||
#compdef mediathek
|
||||
|
||||
function _mediathek {
|
||||
typeset -a targets
|
||||
targets=("${(@f)$(mediathek -l)}")
|
||||
_describe target targets
|
||||
}
|
||||
|
149
compdef/_xdg-utils
Normal file
149
compdef/_xdg-utils
Normal file
|
@ -0,0 +1,149 @@
|
|||
#compdef xdg-mime xdg-desktop-icon
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for xdg-utils (http://portland.freedesktop.org/)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Alexander Gehrke <github@qwertyuiop.de>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
zmodload zsh/mapfile
|
||||
|
||||
_xdg-mime() {
|
||||
local context curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
'1: :_xdg-mime_cmds' \
|
||||
'*::arg:->args' \
|
||||
'--help[show short help]' \
|
||||
'--manual[show manual page]' \
|
||||
'--version[show version info]' \
|
||||
|
||||
case $state in
|
||||
(args)
|
||||
case "${words[1]}" in
|
||||
(query)
|
||||
_arguments \
|
||||
'1: :_xdg-mime_query_commands' \
|
||||
'2: :_xdg-mime_query_params'
|
||||
;;
|
||||
(default)
|
||||
_arguments \
|
||||
'1: :_path_files -g "*.desktop" -W"(/usr/share/applications/ $HOME/.local/applications/)"' \
|
||||
'2: :_xdg-mime_types'
|
||||
;;
|
||||
(install)
|
||||
_arguments \
|
||||
'1: :_files -g "*.xml"' \
|
||||
'--mode[operate on system or user]: :_values "operation mode" system user' \
|
||||
'--novendor[do not check for vendor prefix]'
|
||||
;;
|
||||
(uninstall)
|
||||
_arguments \
|
||||
'1: :_files -g "*.xml"' \
|
||||
'--mode[operate on system or user]: :_values "operation mode" system user' \
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_xdg-mime_cmds() {
|
||||
local commands; commands=(
|
||||
'query:get information related to filetypes'
|
||||
'default:change default application'
|
||||
'install:add filetype descriptions'
|
||||
'uninstall:remove filetype descriptions'
|
||||
)
|
||||
_describe -t xdg-mime-commands "commands" commands
|
||||
}
|
||||
|
||||
_xdg-mime_query_commands() {
|
||||
local commands; commands=(
|
||||
'filetype:get type of a file'
|
||||
'default:get default application for a type'
|
||||
)
|
||||
_describe -t xdg-mime-queries "query type" commands
|
||||
}
|
||||
|
||||
_xdg-mime_query_params() {
|
||||
case $words[2] in
|
||||
(filetype)
|
||||
_files
|
||||
;;
|
||||
(default)
|
||||
_xdg-mime_types
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
_xdg-mime_types() {
|
||||
_values "mime type" ${(f)mapfile[$HOME/.local/mime/types]} ${(f)mapfile[/usr/share/mime/types]}
|
||||
}
|
||||
|
||||
_xdg-desktop-icon() {
|
||||
_arguments \
|
||||
'1: :_xdg-desktop-icon_cmds' \
|
||||
'*::arg:->args' \
|
||||
'--help[show short help]' \
|
||||
'--manual[show manual page]' \
|
||||
'--version[show version info]'
|
||||
|
||||
case $state in
|
||||
(args)
|
||||
case "${words[1]}" in
|
||||
(install)
|
||||
_arguments \
|
||||
': :_files' \
|
||||
'--novendor[do not check for vendor prefix]'
|
||||
;;
|
||||
(uninstall)
|
||||
_files -W "$HOME/Desktop"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_xdg-desktop-icon_cmds() {
|
||||
local commands; commands=(
|
||||
'install:add file to the desktop'
|
||||
'uninstall:remove file from the desktop'
|
||||
)
|
||||
_describe -t xdg-mime-commands "commands" commands
|
||||
}
|
||||
|
||||
# vim:ft=zsh ts=2 sw=2 et
|
Loading…
Reference in a new issue