Add zsh completion for grml2usb
authorMichael Prokop <mika@grml.org>
Mon, 2 Mar 2009 23:02:52 +0000 (00:02 +0100)
committerMichael Prokop <mika@grml.org>
Mon, 2 Mar 2009 23:02:52 +0000 (00:02 +0100)
debian/changelog
grml2usb
zsh/_grml2usb [new file with mode: 0644]

index cacaea7..b5464f8 100644 (file)
@@ -1,3 +1,9 @@
+grml2usb (0.9.3) UNRELEASED; urgency=low
+
+  * Add zsh completion for grml2usb.
+
+ -- Michael Prokop <mika@grml.org>  Tue, 03 Mar 2009 00:02:37 +0100
+
 grml2usb (0.9.2) unstable; urgency=low
 
   * Rewrote grml2usb from scratch (in python). New features:
index c3d7beb..1089dab 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -18,7 +18,7 @@ from inspect import isroutine, isclass
 import datetime, logging, os, re, subprocess, sys, tempfile, time
 
 # global variables
-PROG_VERSION = "0.9.2"
+PROG_VERSION = "0.9.3"
 MOUNTED = set()  # register mountpoints
 TMPFILES = set() # register tmpfiles
 DATESTAMP = time.mktime(datetime.datetime.now().timetuple()) # unique identifier for syslinux.cfg
diff --git a/zsh/_grml2usb b/zsh/_grml2usb
new file mode 100644 (file)
index 0000000..4d0813b
--- /dev/null
@@ -0,0 +1,48 @@
+#compdef grml2usb
+# Filename:      /etc/zsh/completion.d/_grml2usb
+# Purpose:       completion of command grml2usb for zsh (z shell)
+# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+# Bug-Reports:   see http://grml.org/bugs/
+# License:       This file is licensed under the GPL v2.
+################################################################################
+
+local arguments dev
+local -a devices
+
+devices=()
+
+for dev in /dev/sd* /dev/hd* ; do
+  if [[ $(cat /sys/block/${dev#*dev/}/removable 2>/dev/null) == '1' ]] ; then
+     part=$(ls /dev/${dev#*dev/}[0-9])
+     devices+=$part
+  fi
+done
+
+# TODO:
+# * handling of --bootoptions=BOOTOPTIONS and --lilo-binary=LILOBIN
+# * $devices should also list directories as valid target
+# * as output before :device:.... ISO files and/or /live/image should be suggested
+
+arguments=(
+  '--help[display help message and exit]:'
+  '--bootoptions=[use specified bootoptions as default]:'
+  '--bootloader-only[do not copy files but just install a bootloader]'
+  '--copy-only[copy files only but do not install bootloader]'
+  '--dry-run[avoid executing commands]'
+  '--fat16[format specified partition with FAT16]'
+  '--force[force any actions requiring manual interaction]'
+  '--lilo-binary=LILOBIN[lilo executable to be used for installing MBR]:'
+  '--mbr-manager[enable interactive boot manager menu in MBR]'
+  '--quiet[do not output anything but just errors on console]'
+  '--skip-addons[do not install /boot/addons/ files]'
+  '--skip-mbr[do not install a master boot record (MBR) on the device]'
+  '--syslinux[install syslinux bootloader instead of grub]'
+  '--syslinux-mbr[install syslinux master boot record (MBR) instead of default]'
+  '--verbose[enable verbose mode]'
+  '--version[display program version and exit]'
+  ':device:($devices)'
+)
+_arguments -s $arguments
+
+## END OF FILE #################################################################
+# vim:foldmethod=marker