about summary refs log tree commit diff
path: root/Completion/openSUSE
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/openSUSE')
-rw-r--r--Completion/openSUSE/Command/.distfiles8
-rw-r--r--Completion/openSUSE/Command/_SuSEconfig28
-rw-r--r--Completion/openSUSE/Command/_hwinfo79
-rw-r--r--Completion/openSUSE/Command/_osc149
-rw-r--r--Completion/openSUSE/Command/_yast230
-rw-r--r--Completion/openSUSE/Command/_zypper73
6 files changed, 367 insertions, 0 deletions
diff --git a/Completion/openSUSE/Command/.distfiles b/Completion/openSUSE/Command/.distfiles
new file mode 100644
index 000000000..301ef12b3
--- /dev/null
+++ b/Completion/openSUSE/Command/.distfiles
@@ -0,0 +1,8 @@
+DISTFILES_SRC='
+.distfiles
+_hwinfo
+_osc
+_SuSEconfig
+_yast2
+_zypper
+'
diff --git a/Completion/openSUSE/Command/_SuSEconfig b/Completion/openSUSE/Command/_SuSEconfig
new file mode 100644
index 000000000..d50828529
--- /dev/null
+++ b/Completion/openSUSE/Command/_SuSEconfig
@@ -0,0 +1,28 @@
+#compdef SuSEconfig
+
+local curcontext="$curcontext" state line
+typeset -A opt_args
+
+if [[ -z "$_SuSEconfig_modules" ]]; then 
+	for i in /sbin/conf.d/SuSEconfig.*; do
+		case $i in *.rpm*|*.swap|*.bak|*.orig|*~|\#*) continue;; esac
+		_SuSEconfig_modules=($_SuSEconfig_modules ${i##*/SuSEconfig.})
+	done
+fi
+
+
+_arguments \
+  '--help' \
+  '--quick' \
+  '--force' \
+  '--verbose' \
+  '--nonewpackage' \
+  '--module:module:->module' && return 0
+
+case $state in
+	module) compadd $_SuSEconfig_modules ;;
+esac
+
+# Usage: SuSEconfig [--quick|--nonewpackage|--force|--verbose] [--module name]
+
+
diff --git a/Completion/openSUSE/Command/_hwinfo b/Completion/openSUSE/Command/_hwinfo
new file mode 100644
index 000000000..aac0a05ad
--- /dev/null
+++ b/Completion/openSUSE/Command/_hwinfo
@@ -0,0 +1,79 @@
+#compdef hwinfo
+
+_arguments \
+  '--help[show usage info]' \
+  '--version[show libhd version]' \
+  '--short[just a short listing]' \
+  '--log[write info to logfile]:logfile:_files' \
+  '--debug[set debuglevel]:debuglevels:(1 2 3 4 5 6 7 8 9)' \
+  '--dump-db[dump hardware data base, 0: external, 1: internal]:dumpdb:(0 1)' \
+  '--bios' \
+  '--block' \
+  '--bluetooth' \
+  '--braille' \
+  '--bridge' \
+  '--camera' \
+  '--cdrom' \
+  '--chipcard' \
+  '--cpu' \
+  '--disk' \
+  '--dsl' \
+  '--dvb' \
+  '--floppy' \
+  '--framebuffer' \
+  '--gfxcard' \
+  '--hub' \
+  '--ide' \
+  '--isapnp' \
+  '--isdn' \
+  '--joystick' \
+  '--keyboard' \
+  '--memory' \
+  '--modem' \
+  '--monitor' \
+  '--mouse' \
+  '--netcard' \
+  '--network' \
+  '--partition' \
+  '--pci' \
+  '--pcmcia' \
+  '--pcmcia-ctrl' \
+  '--pppoe' \
+  '--printer' \
+  '--scanner' \
+  '--scsi' \
+  '--smp' \
+  '--sound' \
+  '--storage-ctrl' \
+  '--sys' \
+  '--tape' \
+  '--tv' \
+  '--usb' \
+  '--usb-ctrl' \
+  '--vbe' \
+  '--wlan' \
+  '--zip' \
+  '--all' \
+  '--reallyall' && return 0
+
+
+# hwinfo-9.31-1.1
+#
+# Usage: hwinfo [options]
+# Probe for hardware.
+#   --short        just a short listing
+#   --log logfile  write info to logfile
+#   --debug level  set debuglevel
+#   --version      show libhd version
+#   --dump-db n    dump hardware data base, 0: external, 1: internal
+#   --hw_item      probe for hw_item
+#   hw_item is one of:
+#     all, bios, block, bluetooth, braille, bridge, camera, cdrom, chipcard, cpu,
+#     disk, dsl, dvb, floppy, framebuffer, gfxcard, hub, ide, isapnp, isdn,
+#     joystick, keyboard, memory, modem, monitor, mouse, netcard, network,
+#     partition, pci, pcmcia, pcmcia-ctrl, pppoe, printer, scanner, scsi, smp,
+#     sound, storage-ctrl, sys, tape, tv, usb, usb-ctrl, vbe, wlan, zip
+# 
+#   Note: debug info is shown only in the log file. (If you specify a
+#   log file the debug level is implicitly set to a reasonable value.)
+
diff --git a/Completion/openSUSE/Command/_osc b/Completion/openSUSE/Command/_osc
new file mode 100644
index 000000000..2808f92ee
--- /dev/null
+++ b/Completion/openSUSE/Command/_osc
@@ -0,0 +1,149 @@
+#compdef osc
+#
+# Copyright (C) 2009,2010 Holger Macht <holger@homac.de>
+#
+# This file is released under the GPLv2.
+#
+# Based on the the zsh guide from http://zsh.dotsrc.org/Guide/zshguide06.html
+#
+# Toggle verbose completions: zstyle ':completion:*:osc:*' verbose no
+#                             zstyle ':completion:*:osc-subcommand:*' verbose no
+# 
+# Use the variables $ZSH_OSC_BUILD_TARGETS_EXTRA and $ZSH_OSC_PROJECTS_EXTRA to
+# extend the list of possible completions in your ~/.zshrc like that:
+#  export OSC_PROJECTS_EXTRA="Base:System Base:shells"
+#
+# version 0.2
+#
+
+OSC_BUILD_TARGETS="openSUSE_10.2 openSUSE_10.3 openSUSE_11.0 openSUSE_11.1 openSUSE_11.2 openSUSE_11.3 openSUSE_Factory"
+OSC_PROJECTS="openSUSE:Factory openSUSE:11.2 openSUSE:11.3 openSUSE:11.1 openSUSE:11.0 openSUSE:10.3"
+
+# user defined variables $OSC_BUILD_TARGETS_EXTRA and
+# $OSC_PROJECTS_EXTRA can add to the project/build target list
+OSC_BUILD_TARGETS="$OSC_BUILD_TARGETS $ZSH_OSC_BUILD_TARGETS_EXTRA"
+OSC_PROJECTS="$OSC_PROJECTS $ZSH_OSC_PROJECTS_EXTRA"
+
+# Main dispatcher
+
+_osc() {
+    if (( CURRENT > 2 )) && [[ ${words[2]} != "help" ]]; then
+        # Remember the subcommand name
+	local cmd=${words[2]}
+        # Set the context for the subcommand.
+	curcontext="${curcontext%:*:*}:osc-subcommand"
+        # Narrow the range of words we are looking at to exclude `osc'
+	(( CURRENT-- ))
+	shift words
+        # Run the completion for the subcommand
+	if [ "$cmd" = "submitreq" -o "$cmd" = "sr" ]; then
+	    _osc_cmd_submitreq
+	elif [ "$cmd" = "getbinaries" ]; then
+	    _osc_cmd_getbinaries
+	elif [ "$cmd" = "checkout" -o "$cmd" = "co" -o "$cmd" = "branch" ]; then
+	    _osc_cmd_checkout
+	elif [ "$cmd" = "buildlog" -o "$cmd" = "buildinfo" -o "$cmd" = "bl" ]; then
+	    _osc_cmd_buildlog
+	else
+	    _osc_cmd_do $cmd
+	fi
+    else
+	local hline
+	local -a cmdlist
+	local tag=0
+	_call_program help-commands osc help | while read -A hline; do
+	    # start parsing with "commands:"
+	    [[ $hline[1] = "commands:" ]] && tag=1
+	    # stop parsing at the line starting with "For"
+	    [[ $hline[1] = "For" ]] && tag=0
+	    [[ $tag = 0 ]] && continue
+	    # all commands have to start with lower case letters
+	    [[ $hline[1] =~ ^[A-Z] ]] && continue
+	    (( ${#hline} < 2 )) && continue
+
+    	    # ${hline[1]%,} truncates the last ','
+	    cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+	done
+	_describe -t osc-commands 'osc command' cmdlist
+    fi
+}
+
+_osc_cmd_getbinaries() {
+    _arguments \
+	'1:PROJECT:( `echo $OSC_PROJECTS` )' \
+	'2:PACKAGE:(PACKAGE)' \
+	'3:REPOSITORY:( `echo $OSC_BUILD_TARGETS` )' \
+	'4:ARCHITECTURE:(i586 x86_64)'
+}
+
+_osc_cmd_checkout() {
+    _arguments \
+	'1:PROJECT:( `echo $OSC_PROJECTS` )' \
+	'2:PACKAGE:(PACKAGE)'
+}
+
+_osc_cmd_buildlog() {
+    _arguments \
+	'1:REPOSITORY:( `echo $OSC_BUILD_TARGETS` )' \
+	'2:ARCHITECTURE:(i586 x86_64)'
+}
+
+_osc_cmd_submitreq() {
+    local hline
+    local -a cmdlist
+    local tag=0
+    _call_program help-commands osc help $cmd | while read -A hline; do
+        # start parsing from "usage:"
+	[[ $hline[1] = "usage:" ]] && tag=1
+	[[ $tag = 0 ]] && continue
+
+	if [[ $hline[1] =~ ^osc ]]; then
+	    shift hline; shift hline
+	elif ! [[ $hline[1] =~ ^- ]]; then
+            # Option has to start with a '-' or 'osc submitrequest'
+	    continue
+	fi
+
+	(( ${#hline} < 2 )) && continue
+
+	cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+
+    done
+    
+    _describe -t osc-commands 'osc command' cmdlist
+}
+
+
+_osc_cmd_do() {
+    local hline
+    local -a cmdlist
+    local tag=0
+    
+    # only start completion if theres some '-' on the line
+    if ! [ "$words[2]" = "-" ]; then
+	_complete
+	return
+    fi
+
+    _call_program help-commands osc help $cmd | while read -A hline; do
+	# start parsing from "Options:"
+	[[ $hline[1] = "Options:" ]] && tag=1
+	[[ $tag = 0 ]] && continue
+	# Option has to start with a '-'
+	[[ $hline[1] =~ ^- ]] || continue
+	(( ${#hline} < 2 )) && continue
+
+	cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+    done
+
+    if [ -n "$cmdlist" ]; then
+	_describe -t osc-commands 'osc command' cmdlist
+    else
+	_complete
+    fi
+}
+
+# Code to make sure _osc is run when we load it
+_osc "$@"
+
+
diff --git a/Completion/openSUSE/Command/_yast2 b/Completion/openSUSE/Command/_yast2
new file mode 100644
index 000000000..b9c7f2489
--- /dev/null
+++ b/Completion/openSUSE/Command/_yast2
@@ -0,0 +1,30 @@
+#compdef yast2 yast
+
+local curcontext="$curcontext" state line
+typeset -A opt_args
+
+if [[ -z "$_yast2_modules" ]]; then 
+	for i in $(/sbin/yast2 --list | grep -v "Available.*modules"); do
+		_yast2_modules=($_yast2_modules $i)
+	done
+fi
+
+_arguments -s \
+  '(--list)-l[list all available modules]' '(-l)--list' \
+  '(--help)-h[help]' '(-h)--help'\
+  \
+ {'(--geometry)-g[default window size (qt only)]','(-g)--geometry'}':geometry:(800x600+0+0)' \
+  '(--style)-s[widget style (qt only)]' '(-s)--style' \
+  \
+ {'(--install)-i[install rpm package]','(-i)--install'}':filename:_files' \
+  \
+ '--noborder[no window manager border for main window]' '--noborder' \
+ '--fullscreen[use full screen]' '--fullscreen' \
+  \
+  ':module:->module' && return 0
+
+case $state in
+	module) compadd $_yast2_modules; _files -g "*.ycp";;
+esac
+
+
diff --git a/Completion/openSUSE/Command/_zypper b/Completion/openSUSE/Command/_zypper
new file mode 100644
index 000000000..57f942de4
--- /dev/null
+++ b/Completion/openSUSE/Command/_zypper
@@ -0,0 +1,73 @@
+#compdef zypper
+#
+# Copyright (C) 2009 Holger Macht <holger@homac.de>
+#
+# This file is released under the GPLv2.
+#
+# Based on the the zsh guide from http://zsh.dotsrc.org/Guide/zshguide06.html
+#
+# Toggle verbose completions: zstyle ':completion:*:zypper:*' verbose no
+#                             zstyle ':completion:*:zypper-subcommand:*' verbose no
+#
+#  version 0.1
+#
+# Main dispatcher
+
+_zypper() {
+    if (( CURRENT > 2 )) && [[ ${words[2]} != "help" ]]; then
+        # Remember the subcommand name
+	local cmd=${words[2]}
+        # Set the context for the subcommand.
+	curcontext="${curcontext%:*:*}:zypper-subcommand"
+        # Narrow the range of words we are looking at to exclude `zypper'
+	(( CURRENT-- ))
+	shift words
+	
+	_zypper_cmd_do $cmd
+    else
+	local hline
+	local -a cmdlist
+	local tag=0
+	_call_program help-commands zypper help | while read -A hline; do
+	    # start parsing with "Global Options:"
+	    [[ $hline =~ "^Global Options:" ]] && tag=1
+	    [[ $tag = 0 ]] && continue
+	    [[ $hline[1] =~ ^\t\t\t\t ]] && continue
+	    # all commands have to start with lower case letters
+	    [[ $hline[1] =~ ^[A-Z] ]] && continue
+	    (( ${#hline} < 2 )) && continue
+
+	    # cut comma at end of command
+	    hline[1]=`echo $hline[1] | sed -e 's/\(^.*\),/\1/'`
+
+	    # ${hline[1]%,} truncates the last ','
+	    cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+	done
+	_describe -t zypper-commands 'zypper command' cmdlist
+    fi
+}
+
+_zypper_cmd_do() {
+    local hline
+    local -a cmdlist
+    local tag=0
+    _call_program help-commands zypper help $cmd | while read -A hline; do
+	# start parsing from "Options:"
+	[[ $hline =~ "^Command options:" ]] && tag=1
+	[[ $tag = 0 ]] && continue
+	# Option has to start with a '-'
+	[[ $hline[1] =~ ^- ]] || continue
+	(( ${#hline} < 2 )) && continue
+
+	cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+    done
+
+    if [ -n "$cmdlist" ]; then
+	_describe -t zypper-commands 'zypper command' cmdlist
+    else
+	_complete
+    fi
+}
+
+# Code to make sure _zypper is run when we load it
+_zypper "$@"