about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--Completion/Debian/Command/.distfiles4
-rw-r--r--Completion/Debian/Command/_apt-file55
-rw-r--r--Completion/X/Command/.distfiles4
-rw-r--r--Completion/X/Command/_mozilla2
-rw-r--r--Completion/X/Command/_setxkbmap99
6 files changed, 171 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b38c4099b..e8178f4a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-12-17  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 23059: arno: Completion/Debian/Command/_apt-file, also
+	.distfiles: new completion.
+
+	* 23058: arno: Completion/X/Command/_mozilla: handle -CreateProfile.
+
+	* 23057: arno: Completion/X/Command/_setxkbmap, also .distfiles:
+	new completion.
+
 2006-12-15  Peter Stephenson  <pws@csr.com>
 
 	* users/11083: Doc/Zsh/contrib.yo, Functions/Zle/.distfiles,
diff --git a/Completion/Debian/Command/.distfiles b/Completion/Debian/Command/.distfiles
index f38404b10..6e541cb03 100644
--- a/Completion/Debian/Command/.distfiles
+++ b/Completion/Debian/Command/.distfiles
@@ -1,7 +1,9 @@
 DISTFILES_SRC='
 .distfiles
 _a2utils
-_apt                  _aptitude             _apt-move
+_apt                  _aptitude             
+_apt-file
+_apt-move
 _apt-show-versions    _auto-apt             _bts
 _bug                  _dak
 _dchroot              _debchange
diff --git a/Completion/Debian/Command/_apt-file b/Completion/Debian/Command/_apt-file
new file mode 100644
index 000000000..fcc0482e9
--- /dev/null
+++ b/Completion/Debian/Command/_apt-file
@@ -0,0 +1,55 @@
+#compdef apt-file
+
+_apt-file() {
+  local -a arguments
+  local state line cmds 
+  arguments=(
+    '(--cache -c)'{--cache,-c}'[cache directory]:directory:_directories'
+    '(-v --verbose)'{-v,--verbose}'[verbose]'
+     '(--cdrom-mount -d)'{--cdrom-mount,-d}'[cdrom mount point]:directory:_directories'
+     '(--ignore-case -i)'{--ignore-case,-i}'[ignore case]'
+     '(--regexp -r)'{--regexp,-r}'[regular expression]'
+     '(-V --version)'{-V,--version}'[version]'
+     '(-a --architecture)'{-a,--architecture}'[architecture]:architecture:(alpha arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)'
+    '(-s --sources-list)'{-s,--sources-list}'[source.list file]:file:_files'
+    '(-l --package-only)'{-l,--package-only}'[only display package name]'
+    '(-F --fixed-string)'{-F,--fixed-string}'[do not expand search pattern]'
+    '(-y --dummy)'{-y,--dummy}'[run in dummy mode]'
+    '(-h --help)'{-h,--help}'[display help screen]'
+    '1: :->cmds'
+    '*: :->args'
+  )
+    _arguments -S $arguments
+
+    case $state in
+      cmds)
+        cmds=(
+            'update:Resynchronize package contents'
+            'search:Search in which package file is included'
+            'list:List contents of a package'
+            'show:Alias for list'
+            'purge:remove all Contents-<ARCH>.gz files in cache directory'
+        )
+        _describe -t commands 'apt-list command' cmds && ret=0
+      ;;
+      args)
+        case $line[1] in
+            search)
+                _message "pattern"
+            ;;
+            list|show)
+               _deb_packages avail 
+            ;;
+            update|purge)
+                # do nothing
+            ;;
+            *)
+                _message "command $line[1] not available"
+            ;;
+        esac
+      ;;
+    esac
+
+}
+
+_apt-file "$@"
diff --git a/Completion/X/Command/.distfiles b/Completion/X/Command/.distfiles
index f45994bc3..8ce27f599 100644
--- a/Completion/X/Command/.distfiles
+++ b/Completion/X/Command/.distfiles
@@ -4,7 +4,9 @@ _acroread       _dcop
 _gnome-gv       _gqview         _gv             _kfmclient
 _mozilla        _mplayer        _nautilus
 _nedit          _netscape
-_qiv            _urxvt          _vnc
+_qiv            
+_setxkbmap
+_urxvt          _vnc
 _x_utils        _xauth          _xdvi           _xfig           _xloadimage
 _xmodmap        _xpdf           _xscreensaver   _xset           _xterm
 _xv             _xwit
diff --git a/Completion/X/Command/_mozilla b/Completion/X/Command/_mozilla
index eef72d2aa..7b2689757 100644
--- a/Completion/X/Command/_mozilla
+++ b/Completion/X/Command/_mozilla
@@ -27,7 +27,6 @@ else
   else
     mozopts=(
       "($popts)-installer[start with 4.x migration window]"
-      "($popts)-CreateProfile:profile"
       "($popts)-ProfileWizard[start with profile wizard]"
       "($popts)-SelectProfile[start with profile selection dialog]"
       '-splash[enable splash screen]'
@@ -42,6 +41,7 @@ else
   _x_arguments -C  $mozopts \
     '-height[height of startup window]:height' \
     '(-)'{-h,-help}'[show usage message]' \
+      "($popts)-CreateProfile:profile" \
     '-width[width of startup window]:width' \
     '(-)'{-v,-version}'[show the version number and build date]' \
     "($popts)-P[start with profile]:profile:->profile" \
diff --git a/Completion/X/Command/_setxkbmap b/Completion/X/Command/_setxkbmap
new file mode 100644
index 000000000..85609b554
--- /dev/null
+++ b/Completion/X/Command/_setxkbmap
@@ -0,0 +1,99 @@
+# compdef setxkbmap
+
+# TODO:
+# model, option, symbols and types suggestions
+# take -layout and -variant into account
+
+_setxkbmap() {
+    emulate -L zsh
+    setopt extendedglob
+
+    # xkb files may be in different places depending on system
+    local dir sourcedir
+    for dir in /usr/lib/X11/xkb /usr/share/X11/xkb; do
+        if [ -d $dir ] ; then
+           sourcedir=$dir
+           break
+        fi
+    done
+    [ -d $sourcedir ] || return 1
+
+    local -a arguments
+
+    arguments=(
+        '-compat[compability map]:compability:_setxkbmap_compat'
+        '-config[configuration file]:configuration:_files'
+        '-display[display]:display:_x_display'
+        '-geometry[geometry component]:geometry:_setxkbmap_geometry'
+        '-model[model name]:model:'
+        '-option[xkb option]:option:'
+        '(-)'-print'[print component names]'
+        '-rules[rules file]:rules:_files'
+        '-symbols[symbols components]:symbols:'
+        '(-)'{-help,-h}'[Display help message]'
+        '-synch[force synchronization]'
+        '-types[types components]:types:'
+        '(-verbose -v)'{-verbose,-v}'[Set verbosity level]:verbosity:(0 1 2 3 4 5 6 7 8 9)'
+        '*::keyboard:_setxkbmap_dispatcher'
+    )
+    _arguments $arguments
+}
+
+_setxkbmap_dispatcher () {
+
+    case $CURRENT in
+        1)
+            _setxkbmap_layout
+        ;;
+        2)
+            _setxkbmap_variant "$words[1]"
+        ;;
+    esac
+}
+
+_setxkbmap_files () {
+    local dir="$1"
+    local label="$2"
+
+    local -a fullpath shortpath
+
+    fullpath=($sourcedir/$dir/**/*~*README(.))
+    shortpath=(${fullpath#$sourcedir\/$dir\/})
+
+    _wanted layout expl $label compadd -a - shortpath
+
+}
+
+(( $+functions[_setxkbmap_compat] )) ||
+_setxkbmap_compat() {
+    _setxkbmap_files "compat" "compatibility"
+}
+
+(( $+functions[_setxkbmap_layout] )) ||
+_setxkbmap_layout () {
+    _setxkbmap_files "symbols" "layout"
+}
+
+(( $+functions[_setxkbmap_geometry] )) ||
+_setxkbmap_geometry () {
+    _setxkbmap_files "geometry" "geometry"
+}
+
+(( $+functions[_setxkbmap_variant] )) ||
+_setxkbmap_variant () {
+    local file=$sourcedir/symbols/${1}
+    local -a variants lines
+
+    if [ ! -f $file ]; then
+        _message "no such layout: ${1}"
+        return 1
+    fi
+
+    lines=("${(f)$(< ${file})}")
+    variants=(${${${(M)lines:#*xkb_symbols*\"([[:alnum:]])##\"*}##*xkb_symbols([^\"])##\"}%%\"*})
+    
+    _wanted variant expl 'variant' compadd -a variants
+
+}
+
+_setxkbmap "$@"