Make _userland easier to use.
This commit is contained in:
parent
4e5a67cfaf
commit
5afc526850
@ -92,14 +92,13 @@ complete -b builtin
|
||||
|
||||
# start of section containing completion functions called by other functions
|
||||
|
||||
# Output what userland we're running on
|
||||
# Check if we're running on the given userland
|
||||
# @param $1 userland to check for
|
||||
_userland()
|
||||
{
|
||||
local uname=$( uname -s )
|
||||
case $uname in
|
||||
Linux|GNU|GNU/*) echo GNU ;;
|
||||
*) echo "$uname" ;;
|
||||
esac
|
||||
local userland=$( uname -s )
|
||||
[[ $userland == @(Linux|GNU/*) ]] && userland=GNU
|
||||
[[ $userland == $1 ]]
|
||||
}
|
||||
|
||||
# This function checks whether we have a given program on the system.
|
||||
|
@ -47,8 +47,8 @@ _gcc()
|
||||
} &&
|
||||
complete -F _gcc gcc g++ c++ g77 gcj gpc
|
||||
|
||||
[[ $OSTYPE == *cygwin* || $( _userland ) == GNU ]] \
|
||||
&& _have gcc && complete -F _gcc cc || :
|
||||
[[ $OSTYPE == *cygwin* ]] || _userland GNU && _have gcc && \
|
||||
complete -F _gcc cc || :
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Red Hat & Debian GNU/Linux if{up,down} completion
|
||||
|
||||
[[ $( _userland ) == GNU ]] || return 1
|
||||
_userland GNU || return 1
|
||||
|
||||
_ifupdown()
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
# man(1) completion
|
||||
|
||||
[[ $OSTYPE == *@(darwin|freebsd|solaris|cygwin|openbsd)* || \
|
||||
$( _userland ) == GNU ]] || return 1
|
||||
[[ $OSTYPE == *@(darwin|freebsd|solaris|cygwin|openbsd)* ]] || _userland GNU \
|
||||
|| return 1
|
||||
|
||||
_man()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user