Skip to content

Commit 72af5d0

Browse files
authored
Merge pull request #488 from SmartFinn/patool-completion
Add completion for patool
2 parents 425c193 + 8855715 commit 72af5d0

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

Diff for: src/_patool

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#compdef patool
2+
# ------------------------------------------------------------------------------
3+
# Copyright (c) 2017 Github zsh-users - http://github.com/zsh-users
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining
6+
# a copy of this software and associated documentation files (the
7+
# "Software"), to deal in the Software without restriction, including
8+
# without limitation the rights to use, copy, modify, merge, publish,
9+
# distribute, sublicense, and/or sell copies of the Software, and to
10+
# permit persons to whom the Software is furnished to do so, subject to
11+
# the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included
14+
# in all copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
# OTHER DEALINGS IN THE SOFTWARE.
23+
# ------------------------------------------------------------------------------
24+
# Description
25+
# -----------
26+
#
27+
# Completion script for patool (https://github.com/wummel/patool).
28+
#
29+
# ------------------------------------------------------------------------------
30+
# Authors
31+
# -------
32+
#
33+
# * Sergei Eremenko (https://github.com/SmartFinn)
34+
#
35+
# ------------------------------------------------------------------------------
36+
37+
local state line ret=1
38+
39+
_arguments -C \
40+
'(-h --help)'{-h,--help}'[show help message and exit]' \
41+
'(--non-interactive)'--non-interactive'[do not query for user input]' \
42+
'(-v --verbose)'{-v,--verbose}'[verbose operation]' \
43+
'1:cmd:->cmds' \
44+
'*:arg:->args' && ret=0
45+
46+
case $state in
47+
(cmds)
48+
local -a cmds
49+
50+
cmds=(
51+
'create:create an archive from given files'
52+
'diff:show differences between two archives'
53+
'extract:extract files from given archives'
54+
'formats:show all supported archive formats'
55+
'list:list files in archives'
56+
'repack:repackage archive to a different format'
57+
'recompress:recompress an archive to smaller size'
58+
'search:search in archive contents for given pattern'
59+
'test:test the given archives'
60+
)
61+
62+
_describe -t commands 'patool commands' cmds && ret=0
63+
;;
64+
(args)
65+
case $line[1] in
66+
(extract)
67+
_arguments \
68+
'--outdir[extract to the given output directory]:select directory:_files -/' \
69+
'*:files:_files' && ret=0
70+
;;
71+
(formats)
72+
_message 'no more arguments' && ret=0
73+
;;
74+
(search)
75+
_arguments \
76+
'2:search pattern:' \
77+
'*:files:_files' && ret=0
78+
;;
79+
(*)
80+
_arguments \
81+
'*:files:_files' && ret=0
82+
;;
83+
esac
84+
;;
85+
esac
86+
87+
return $ret
88+
89+
# Local Variables:
90+
# mode: Shell-Script
91+
# sh-indentation: 2
92+
# indent-tabs-mode: nil
93+
# sh-basic-offset: 2
94+
# End:
95+
# vim: ft=zsh sw=2 ts=2 et

0 commit comments

Comments
 (0)