mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
cat_in_136: 17200: new lha and nkf completions
This commit is contained in:
parent
85a698b8ec
commit
a00b866099
4 changed files with 128 additions and 1 deletions
|
@ -1,5 +1,9 @@
|
|||
2012-08-07 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* cat_in_136: 17200: Completion/Unix/Command/.distfiles,
|
||||
Completion/Unix/Command/_lha, Completion/Unix/Command/_nkf: new
|
||||
completions. nkf is a Kanji code converter.
|
||||
|
||||
* YAMAMOTO Takashi: 30599: Src/compat.c, Src/zsh.h: don't
|
||||
use the replacement wcwidth if not ISO-10646 as the assumptions
|
||||
it makes probably won't work.
|
||||
|
@ -16473,5 +16477,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5685 $
|
||||
* $Revision: 1.5686 $
|
||||
*****************************************************
|
||||
|
|
|
@ -111,6 +111,7 @@ _kvno
|
|||
_last
|
||||
_ldd
|
||||
_less
|
||||
_lha
|
||||
_links
|
||||
_ln
|
||||
_loadkeys
|
||||
|
@ -143,6 +144,7 @@ _mysqldiff
|
|||
_ncftp
|
||||
_netcat
|
||||
_nice
|
||||
_nkf
|
||||
_nm
|
||||
_nmap
|
||||
_notmuch
|
||||
|
|
77
Completion/Unix/Command/_lha
Normal file
77
Completion/Unix/Command/_lha
Normal file
|
@ -0,0 +1,77 @@
|
|||
#compdef lha
|
||||
|
||||
if (( CURRENT == 2 )); then
|
||||
compset -P -
|
||||
|
||||
local lhacmds
|
||||
lhacmds=(
|
||||
'( x l v u d m c p t)a[Add \(Or replace\) to archive]'
|
||||
'(a l v u d m c p t)x[EXtract from archive]'
|
||||
'(a x v u d m c p t)l[List]'
|
||||
'(a x l u d m c p t)v[Verbose List]'
|
||||
'(a x l v d m c p t)u[Update newer files to archive]'
|
||||
'(a x l v u m c p t)d[Delete from archive]'
|
||||
'(a x l v u d c p t)m[Move to archive]'
|
||||
'(a x l v u d m p t)c[re-Construct new archive]'
|
||||
'(a x l v u d m c t)p[Print to STDOUT from archive]'
|
||||
'(a x l v u d m c p )t[Test file CRC in archive]'
|
||||
)
|
||||
|
||||
if [ "${words[2]#-}" != "" ]; then
|
||||
lhacmds=($lhacmds
|
||||
'v[verbose]'
|
||||
'q[quiet]'
|
||||
'n[not execute]'
|
||||
'f[force\(over write at extract\)]'
|
||||
't[FILES are TEXT file]'
|
||||
'e[TEXT code convert from/to EUC]'
|
||||
'g[Generic format \(for compatibility\)]'
|
||||
)
|
||||
case ${words[2]#-} in
|
||||
a*|u*)
|
||||
lhacmds=($lhacmds
|
||||
'd[delete FILES after]'
|
||||
'z[files not compress]'
|
||||
'( 1 2)0[header level 0]'
|
||||
'(0 2)1[header level 1]'
|
||||
'(0 1 )2[header level 2]'
|
||||
)
|
||||
;;
|
||||
c*)
|
||||
lhacmds=($lhacmds 'd[delete FILES after]')
|
||||
;;
|
||||
x*)
|
||||
lhacmds=($lhacmds 'i[ignore directory path]')
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
_values -s '' 'lha command' \
|
||||
$lhacmds \
|
||||
&& return 0
|
||||
elif (( CURRENT == 3 )); then
|
||||
_arguments -C \
|
||||
'*:LHA file:_files -g \*.lzh' && return 0
|
||||
else
|
||||
case ${words[2]#-} in
|
||||
l*|x*|d*)
|
||||
if [ -f "$words[3]" ]; then
|
||||
_lzh_cache_list=`$words[1] lq $words[3] | awk '{print $8}'`
|
||||
_lzh_cache_list=("${(@f)${_lzh_cache_list}}")
|
||||
|
||||
_wanted files expl 'file from archive' _multi_parts / _lzh_cache_list
|
||||
|
||||
return 0
|
||||
else
|
||||
_message -r "Archive file is not found : ${words[3]}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
;;
|
||||
*)
|
||||
_arguments -C \
|
||||
'*:file:_files' && return 0
|
||||
esac
|
||||
fi
|
||||
|
||||
return 0
|
44
Completion/Unix/Command/_nkf
Normal file
44
Completion/Unix/Command/_nkf
Normal file
|
@ -0,0 +1,44 @@
|
|||
#compdef nkf
|
||||
|
||||
typeset -A opt_args
|
||||
|
||||
local outputsshort="-j -s -e -w -w8 -w16 -w16b0 -w16b -w16l0 -w16l"
|
||||
local outputs="$outputsshort --fj --unix --mac --windows --jis --euc --sjis --utf8 --utf16"
|
||||
local inputs=${outputsshort:u}
|
||||
|
||||
_arguments -s \
|
||||
'(-u)-b[Output is buffered]' \
|
||||
'(-b)-u[Output is unbuffered]' \
|
||||
'($outputs)'{-j,--jis}'[Output is JIS 7 bit]' \
|
||||
'($outputs)'{-e,--sjis}'[Output is Shift JIS]' \
|
||||
'($outputs)'{-s,--euc}'[Output is EUC-JP]' \
|
||||
'($outputs)'{-w,--utf8}'[Output is UTF-8 (No BOM)]' \
|
||||
'($outputs)-w8[Output is UTF-8 (BOM)]' \
|
||||
'($outputs)'{-w16,-w16b0,--utf16}'[Output is UTF-16 (BigEndian; No BOM)]' \
|
||||
'($outputs)-w16b[Output is UTF-16 (BigEndian; BOM)]' \
|
||||
'($outputs)-w16l0[Output is UTF-16 (Little Endian; No BOM)]' \
|
||||
'($outputs)-w16l[Output is UTF-16 (Little Endian; BOM)]' \
|
||||
'($outputs)--fj[Output is for fj]' \
|
||||
'($outputs)--unix[Output is for unix]' \
|
||||
'($outputs)--mac[Output is for Mac]' \
|
||||
'($outputs)--windows[Output is for Windows]' \
|
||||
'($inputs)-J[Input assumption is JIS 7 bit]' \
|
||||
'($inputs)-E[Input assumption is Shift JIS]' \
|
||||
'($inputs)-S[Input assumption is EUC-JP]' \
|
||||
'($inputs)-W[Input assumption is UTF-8 (No BOM)]' \
|
||||
'($inputs)-W8[Input assumption is UTF-8 (BOM)]' \
|
||||
'($inputs)-W16[Input assumption is UTF-16 (BigEndian; No BOM)]' \
|
||||
'($inputs)-W16b[Input assumption is UTF-16 (BigEndian; BOM)]' \
|
||||
'($inputs)-W16l0[Input assumption is UTF-16 (Little Endian; No BOM)]' \
|
||||
'($inputs)-W16l[Input assumption is UTF-16 (Little Endian; BOM)]' \
|
||||
'(-M)-m-[MIME decode]:mime decode:((B\:base64 Q\:quoted S\:strict N\:non-strict 0\:no-decode))' \
|
||||
'(-m)-M-[MIME encode]:mime encode:((\:header B\:base64 Q\:quoted))' \
|
||||
'-h-[hirakana<->katakana]:hirakata:((1\:hirakana-\>katakana 2\:katakana-\>hirakana 3\:both))' \
|
||||
'-L-[line mode]:line mode:((u\:LF w\:CRLF m\:CR))' \
|
||||
'-I[Convert non ISO-2022-JP charactor to GETA]' \
|
||||
'(--cap-input --url-input)'{--cap-input,--url-input}'[Convert hex after \: or \%]' \
|
||||
'--overwrite[Overwrite original listed files by filtered result]' \
|
||||
'(-v --help)'{-v,--help}'[display help message]' \
|
||||
'*:file:_files' && return 0
|
||||
|
||||
return 1
|
Loading…
Reference in a new issue