From a00b866099be20e58e2db2c8340bbf190f26dfc3 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 7 Aug 2012 18:43:40 +0000 Subject: cat_in_136: 17200: new lha and nkf completions --- Completion/Unix/Command/.distfiles | 2 + Completion/Unix/Command/_lha | 77 ++++++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_nkf | 44 ++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 Completion/Unix/Command/_lha create mode 100644 Completion/Unix/Command/_nkf (limited to 'Completion') diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 355cb9cf9..f5a9c1266 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -111,6 +111,7 @@ _kvno _last _ldd _less +_lha _links _ln _loadkeys @@ -143,6 +144,7 @@ _mysqldiff _ncftp _netcat _nice +_nkf _nm _nmap _notmuch diff --git a/Completion/Unix/Command/_lha b/Completion/Unix/Command/_lha new file mode 100644 index 000000000..5a238d807 --- /dev/null +++ b/Completion/Unix/Command/_lha @@ -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 diff --git a/Completion/Unix/Command/_nkf b/Completion/Unix/Command/_nkf new file mode 100644 index 000000000..4d541274d --- /dev/null +++ b/Completion/Unix/Command/_nkf @@ -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 -- cgit 1.4.1