mirror of
https://github.com/zsh-users/zsh
synced 2024-09-30 13:14:03 +00:00
İsmail Dönmez: 29020: new openSUSE completions
This commit is contained in:
parent
2938c58c82
commit
f8e254aa85
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,12 @@
|
||||||
|
2011-04-30 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
|
* İsmail Dönmez: 29020: Completion/openSUSE/Command/_SuSEconfig,
|
||||||
|
Completion/openSUSE/Command/_hwinfo,
|
||||||
|
Completion/openSUSE/Command/_osc,
|
||||||
|
Completion/openSUSE/Command/_yast2,
|
||||||
|
Completion/openSUSE/Command/_zypper (plus .distfiles): new
|
||||||
|
completions.
|
||||||
|
|
||||||
2011-04-29 Barton E. Schaefer <schaefer@zsh.org>
|
2011-04-29 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
* 29107: Src/Zle/zle_tricky.c: replace overlapping strcpy with
|
* 29107: Src/Zle/zle_tricky.c: replace overlapping strcpy with
|
||||||
|
@ -14534,5 +14543,5 @@
|
||||||
|
|
||||||
*****************************************************
|
*****************************************************
|
||||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||||
* $Revision: 1.5266 $
|
* $Revision: 1.5267 $
|
||||||
*****************************************************
|
*****************************************************
|
||||||
|
|
8
Completion/openSUSE/Command/.distfiles
Normal file
8
Completion/openSUSE/Command/.distfiles
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
DISTFILES_SRC='
|
||||||
|
.distfiles
|
||||||
|
_hwinfo
|
||||||
|
_osc
|
||||||
|
_SuSEconfig
|
||||||
|
_yast2
|
||||||
|
_zypper
|
||||||
|
'
|
28
Completion/openSUSE/Command/_SuSEconfig
Normal file
28
Completion/openSUSE/Command/_SuSEconfig
Normal file
|
@ -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]
|
||||||
|
|
||||||
|
|
79
Completion/openSUSE/Command/_hwinfo
Normal file
79
Completion/openSUSE/Command/_hwinfo
Normal file
|
@ -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.)
|
||||||
|
|
149
Completion/openSUSE/Command/_osc
Normal file
149
Completion/openSUSE/Command/_osc
Normal file
|
@ -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 "$@"
|
||||||
|
|
||||||
|
|
30
Completion/openSUSE/Command/_yast2
Normal file
30
Completion/openSUSE/Command/_yast2
Normal file
|
@ -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
|
||||||
|
|
||||||
|
|
73
Completion/openSUSE/Command/_zypper
Normal file
73
Completion/openSUSE/Command/_zypper
Normal file
|
@ -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 "$@"
|
Loading…
Reference in a new issue