about summary refs log tree commit diff
path: root/Completion/Unix/Command/_lha
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-08-07 18:43:40 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-08-07 18:43:40 +0000
commita00b866099be20e58e2db2c8340bbf190f26dfc3 (patch)
tree3c13e943b1358f5fa7601790cea4b30ee6dfca04 /Completion/Unix/Command/_lha
parent85a698b8ec0c68ce6bf130dbe909ca5ff129c6d9 (diff)
downloadzsh-a00b866099be20e58e2db2c8340bbf190f26dfc3.tar.gz
zsh-a00b866099be20e58e2db2c8340bbf190f26dfc3.tar.xz
zsh-a00b866099be20e58e2db2c8340bbf190f26dfc3.zip
cat_in_136: 17200: new lha and nkf completions
Diffstat (limited to 'Completion/Unix/Command/_lha')
-rw-r--r--Completion/Unix/Command/_lha77
1 files changed, 77 insertions, 0 deletions
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