Merge pull request #699 from syohex/syohex/flameshot
Add flameshot completion
This commit is contained in:
commit
e928ee1764
|
@ -0,0 +1,114 @@
|
|||
#compdef flameshot
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 flameshot (https://flameshot.js.org/)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Shohei YOSHIDA <syohex@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
typeset -A opt_args
|
||||
local context state line
|
||||
|
||||
local -a _flameshot_subcommands
|
||||
_flameshot_subcommands=(
|
||||
'gui:Start a manual capture in GUI mode'
|
||||
'screen:Capture a single screen'
|
||||
'full:Capture the entire desktop'
|
||||
'launcher:Open the capture launcher'
|
||||
'config:Configure flameshot'
|
||||
)
|
||||
|
||||
local -a capture_flags
|
||||
capture_flags=(
|
||||
'(-p --path)'{-p,--path}'[Path where the capture will be saved]:file:_files'
|
||||
'(-d --delay)'{-d,--delay}'[Delay time in milliseconds]:milliseconds:'
|
||||
'(-r --raw)'{-r,--raw}'[Print raw PNG capture]'
|
||||
'(- 1 *)'{-h,--help}'[enable data race detection]'
|
||||
)
|
||||
|
||||
#_arguments '*:: :->subcmd'
|
||||
_arguments \
|
||||
'(- 1 *)'{-h,--help}'[Show this help]' \
|
||||
'*:: :->subcmd'
|
||||
|
||||
if [[ "$state" == "subcmd" ]];then
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "flameshot command" _flameshot_subcommands -V1
|
||||
return
|
||||
else
|
||||
local opts curcontext
|
||||
|
||||
case "$words[1]" in
|
||||
gui)
|
||||
opts=(${capture_flags[@]})
|
||||
;;
|
||||
screen)
|
||||
opts=(
|
||||
${capture_flags[@]}
|
||||
'(-n --number)'{-n,--number}'[Define the screen to capture]:screen number:'
|
||||
'(-c --clipboard)'{-c,--clipboard}'[Save the capture to the clipboard]'
|
||||
)
|
||||
;;
|
||||
full)
|
||||
opts=(
|
||||
${capture_flags[@]}
|
||||
'(-c --clipboard)'{-c,--clipboard}'[Save the capture to the clipboard]'
|
||||
)
|
||||
;;
|
||||
config)
|
||||
opts=(
|
||||
'(-a --autostart)'{-a,--autostart}'[Enable or disable run at startup]:enabled:(true false)'
|
||||
'(-f --filename)'{-f,--filename}'[Set the filename pattern]:pattern:'
|
||||
'(-t --trayicon)'{-t,--trayicon}'[Enable or disable trayicon]:enabled:(true false)'
|
||||
'(-s --showhelp)'{-s,--showhelp}'[Show the help message in the capture mode]:enabled:(true false)'
|
||||
'(-m --maincolor)'{-m,--maincolor}'[Define the main UI color]:color code:'
|
||||
'(-k --contrastcolor)'{-k,--contrastcolor}'[Define the contract UI color]:color code:'
|
||||
'(- 1 *)'{-h,--help}'[Display help]'
|
||||
)
|
||||
;;
|
||||
*)
|
||||
opts=(
|
||||
'(- 1 *)'{-h,--help}'[Display help]'
|
||||
)
|
||||
;;
|
||||
esac
|
||||
_arguments -s : "$opts[@]"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
Loading…
Reference in New Issue