Split various FreeBSD completions to contrib/ .
This commit is contained in:
parent
acef9e78e3
commit
cba4d8faf8
3
CHANGES
3
CHANGES
@ -83,6 +83,9 @@ bash-completion (1.x)
|
|||||||
* Remove debug output noise from quotaon completion.
|
* Remove debug output noise from quotaon completion.
|
||||||
* Split Linux wireless tools completion to contrib/wireless-tools.
|
* Split Linux wireless tools completion to contrib/wireless-tools.
|
||||||
* Add mock completion.
|
* Add mock completion.
|
||||||
|
* Split FreeBSD kld(un)load completion to contrib/kldload.
|
||||||
|
* Split FreeBSD pkg_* completion to contrib/pkg_install.
|
||||||
|
* Split FreeBSD portupgrade and friends completion to contrib/portupgrade.
|
||||||
|
|
||||||
[ Todd Zullinger ]
|
[ Todd Zullinger ]
|
||||||
* Make yum complete on filenames after install, deplist, update and upgrade
|
* Make yum complete on filenames after install, deplist, update and upgrade
|
||||||
|
@ -56,6 +56,7 @@ bashcomp_DATA = contrib/ant \
|
|||||||
contrib/isql \
|
contrib/isql \
|
||||||
contrib/jar \
|
contrib/jar \
|
||||||
contrib/java \
|
contrib/java \
|
||||||
|
contrib/kldload \
|
||||||
contrib/larch \
|
contrib/larch \
|
||||||
contrib/ldapvi \
|
contrib/ldapvi \
|
||||||
contrib/lftp \
|
contrib/lftp \
|
||||||
@ -91,6 +92,8 @@ bashcomp_DATA = contrib/ant \
|
|||||||
contrib/perl \
|
contrib/perl \
|
||||||
contrib/pine \
|
contrib/pine \
|
||||||
contrib/pkg-config \
|
contrib/pkg-config \
|
||||||
|
contrib/pkg_install \
|
||||||
|
contrib/portupgrade \
|
||||||
contrib/postgresql \
|
contrib/postgresql \
|
||||||
contrib/postfix \
|
contrib/postfix \
|
||||||
contrib/povray \
|
contrib/povray \
|
||||||
|
@ -1407,104 +1407,6 @@ for i in env netstat seq uname units wget; do
|
|||||||
done
|
done
|
||||||
unset i
|
unset i
|
||||||
|
|
||||||
[ $UNAME = FreeBSD ] && {
|
|
||||||
# FreeBSD package management tool completion
|
|
||||||
#
|
|
||||||
_pkg_delete()
|
|
||||||
{
|
|
||||||
local cur pkgdir prev
|
|
||||||
|
|
||||||
pkgdir=${PKG_DBDIR:-/var/db/pkg}/
|
|
||||||
cur=`_get_cword`
|
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
||||||
|
|
||||||
[ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
|
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -d $pkgdir$cur ) )
|
|
||||||
COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
complete -F _pkg_delete $dirnames pkg_delete pkg_info
|
|
||||||
have pkg_deinstall && complete -F _pkg_delete $dirnames pkg_deinstall
|
|
||||||
|
|
||||||
# FreeBSD kernel module commands
|
|
||||||
#
|
|
||||||
_kldload()
|
|
||||||
{
|
|
||||||
local cur moddir
|
|
||||||
|
|
||||||
moddir=/modules/
|
|
||||||
[ -d $moddir ] || moddir=/boot/kernel/
|
|
||||||
cur=`_get_cword`
|
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -f $moddir$cur ) )
|
|
||||||
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
|
|
||||||
COMPREPLY=( ${COMPREPLY[@]%.ko} )
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
complete -F _kldload $filenames kldload
|
|
||||||
|
|
||||||
_kldunload()
|
|
||||||
{
|
|
||||||
local cur
|
|
||||||
cur=`_get_cword`
|
|
||||||
COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
|
|
||||||
}
|
|
||||||
complete -F _kldunload $filenames kldunload
|
|
||||||
}
|
|
||||||
|
|
||||||
# FreeBSD portupgrade completion
|
|
||||||
#
|
|
||||||
have portupgrade &&
|
|
||||||
_portupgrade()
|
|
||||||
{
|
|
||||||
local cur pkgdir prev
|
|
||||||
|
|
||||||
pkgdir=${PKG_DBDIR:-/var/db/pkg}/
|
|
||||||
cur=`_get_cword`
|
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
||||||
|
|
||||||
[ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
|
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -d $pkgdir$cur ) )
|
|
||||||
COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
|
|
||||||
COMPREPLY=( ${COMPREPLY[@]%-*} )
|
|
||||||
|
|
||||||
return 0
|
|
||||||
} &&
|
|
||||||
complete -F _portupgrade $dirnames portupgrade
|
|
||||||
|
|
||||||
# FreeBSD portinstall completion
|
|
||||||
#
|
|
||||||
have portinstall &&
|
|
||||||
_portinstall()
|
|
||||||
{
|
|
||||||
local cur portsdir prev indexfile
|
|
||||||
local -a COMPREPLY2
|
|
||||||
|
|
||||||
portsdir=${PORTSDIR:-/usr/ports}/
|
|
||||||
cur=`_get_cword`
|
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
||||||
# First try INDEX-5
|
|
||||||
indexfile=$portsdir/INDEX-5
|
|
||||||
# Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
|
|
||||||
[ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] ||
|
|
||||||
indexfile=$portsdir/INDEX
|
|
||||||
|
|
||||||
[ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
|
|
||||||
|
|
||||||
COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) )
|
|
||||||
COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
|
|
||||||
cut -d'|' -f2 ) )
|
|
||||||
COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
|
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
|
|
||||||
|
|
||||||
return 0
|
|
||||||
} &&
|
|
||||||
complete -F _portinstall $dirnames portinstall
|
|
||||||
|
|
||||||
# Slackware Linux removepkg completion
|
# Slackware Linux removepkg completion
|
||||||
#
|
#
|
||||||
have removepkg && [ -f /etc/slackware-version ] &&
|
have removepkg && [ -f /etc/slackware-version ] &&
|
||||||
|
34
contrib/kldload
Normal file
34
contrib/kldload
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
|
||||||
|
# ex: ts=8 sw=8 noet filetype=sh
|
||||||
|
#
|
||||||
|
# bash completion for FreeBSD kernel module commands
|
||||||
|
|
||||||
|
[ $UNAME = FreeBSD ] &&
|
||||||
|
{
|
||||||
|
|
||||||
|
_kldload()
|
||||||
|
{
|
||||||
|
local cur moddir
|
||||||
|
|
||||||
|
moddir=/modules/
|
||||||
|
[ -d $moddir ] || moddir=/boot/kernel/
|
||||||
|
cur=`_get_cword`
|
||||||
|
|
||||||
|
COMPREPLY=( $( compgen -f $moddir$cur ) )
|
||||||
|
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
|
||||||
|
COMPREPLY=( ${COMPREPLY[@]%.ko} )
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
complete -F _kldload $filenames kldload
|
||||||
|
|
||||||
|
_kldunload()
|
||||||
|
{
|
||||||
|
local cur
|
||||||
|
cur=`_get_cword`
|
||||||
|
COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
|
||||||
|
}
|
||||||
|
complete -F _kldunload $filenames kldunload
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
contrib/pkg_install
Normal file
26
contrib/pkg_install
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
|
||||||
|
# ex: ts=8 sw=8 noet filetype=sh
|
||||||
|
#
|
||||||
|
# bash completion for FreeBSD base package management tools
|
||||||
|
|
||||||
|
[ $UNAME = FreeBSD ] &&
|
||||||
|
{
|
||||||
|
|
||||||
|
_pkg_delete()
|
||||||
|
{
|
||||||
|
local cur pkgdir prev
|
||||||
|
|
||||||
|
pkgdir=${PKG_DBDIR:-/var/db/pkg}/
|
||||||
|
cur=`_get_cword`
|
||||||
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
|
[ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
|
||||||
|
|
||||||
|
COMPREPLY=( $( compgen -d $pkgdir$cur ) )
|
||||||
|
COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
complete -F _pkg_delete $dirnames pkg_delete pkg_info
|
||||||
|
|
||||||
|
}
|
54
contrib/portupgrade
Normal file
54
contrib/portupgrade
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
|
||||||
|
# ex: ts=8 sw=8 noet filetype=sh
|
||||||
|
#
|
||||||
|
# bash completion for FreeBSD portupgrade package
|
||||||
|
|
||||||
|
have portupgrade &&
|
||||||
|
_portupgrade()
|
||||||
|
{
|
||||||
|
local cur pkgdir prev
|
||||||
|
|
||||||
|
pkgdir=${PKG_DBDIR:-/var/db/pkg}/
|
||||||
|
cur=`_get_cword`
|
||||||
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
|
[ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
|
||||||
|
|
||||||
|
COMPREPLY=( $( compgen -d $pkgdir$cur ) )
|
||||||
|
COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
|
||||||
|
COMPREPLY=( ${COMPREPLY[@]%-*} )
|
||||||
|
|
||||||
|
return 0
|
||||||
|
} &&
|
||||||
|
complete -F _portupgrade $dirnames portupgrade
|
||||||
|
|
||||||
|
have portinstall &&
|
||||||
|
_portinstall()
|
||||||
|
{
|
||||||
|
local cur portsdir prev indexfile
|
||||||
|
local -a COMPREPLY2
|
||||||
|
|
||||||
|
portsdir=${PORTSDIR:-/usr/ports}/
|
||||||
|
cur=`_get_cword`
|
||||||
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
# First try INDEX-5
|
||||||
|
indexfile=$portsdir/INDEX-5
|
||||||
|
# Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
|
||||||
|
[ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] ||
|
||||||
|
indexfile=$portsdir/INDEX
|
||||||
|
|
||||||
|
[ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
|
||||||
|
|
||||||
|
COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) )
|
||||||
|
COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
|
||||||
|
cut -d'|' -f2 ) )
|
||||||
|
COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
|
||||||
|
COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
|
||||||
|
|
||||||
|
return 0
|
||||||
|
} &&
|
||||||
|
complete -F _portinstall $dirnames portinstall
|
||||||
|
|
||||||
|
# _pkg_delete is in pkg_install
|
||||||
|
type _pkg_delete &>/dev/null && have pkg_deinstall && \
|
||||||
|
complete -F _pkg_delete $dirnames pkg_deinstall
|
Loading…
x
Reference in New Issue
Block a user