diff -Nurd bash-completion-1.3/bash_completion bash-completion-1.3-new/bash_completion --- bash-completion-1.3/bash_completion 2011-02-06 14:16:00.000000000 -0500 +++ bash-completion-1.3-new/bash_completion 2011-04-28 18:11:02.000000000 -0400 @@ -39,9 +39,9 @@ # Alter the following to reflect the location of this file. # -[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=/etc/bash_completion -[ -n "$BASH_COMPLETION_DIR" ] || BASH_COMPLETION_DIR=/etc/bash_completion.d -[ -n "$BASH_COMPLETION_COMPAT_DIR" ] || BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d +[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=@PREFIX@/etc/bash_completion +[ -n "$BASH_COMPLETION_DIR" ] || BASH_COMPLETION_DIR=@PREFIX@/etc/bash_completion.d +[ -n "$BASH_COMPLETION_COMPAT_DIR" ] || BASH_COMPLETION_COMPAT_DIR=@FINKPREFIX@/etc/bash_completion.d readonly BASH_COMPLETION BASH_COMPLETION_DIR BASH_COMPLETION_COMPAT_DIR # Set a couple of useful vars @@ -735,7 +735,11 @@ # _configured_interfaces() { - if [ -f /etc/debian_version ]; then + if [ $UNAME eq "Darwin" ]; then + # TODO/FIXME: Update this to new bash_completion code + COMPREPLY=( $( compgen -W "$( /sbin/ifconfig | \ + grep -E '^[^[:space:]]+:' | cut -d: -f1 )" -- "$cur" ) ) + elif [ -f /etc/debian_version ]; then # Debian system COMPREPLY=( $( compgen -W "$( sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p'\ /etc/network/interfaces )" -- "$cur" ) ) @@ -1245,8 +1249,8 @@ [ -r "$configfile" ] && config=( "${config[@]}" "$configfile" ) else - for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" \ - "${HOME}/.ssh2/config"; do + for i in @FINKPREFIX@/etc/ssh/ssh_config /etc/ssh_config \ + "${HOME}/.ssh/config" "${HOME}/.ssh2/config"; do [ -r $i ] && config=( "${config[@]}" "$i" ) done fi @@ -1272,9 +1276,11 @@ if [ -z "$configfile" ]; then # Global and user known_hosts files - for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \ - /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \ - ~/.ssh/known_hosts2; do + for i in @FINKPREFIX@/etc/ssh/ssh_known_hosts @FINKPREFIX@/etc/ssh/ssh_known_hosts2 \ + /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \ + @FINKPREFIX@/etc/known_hosts @FINKPREFIX@/etc/known_hosts2 \ + /etc/known_hosts /etc/known_hosts2 \ + ~/.ssh/known_hosts ~/.ssh/known_hosts2; do [ -r $i ] && kh=( "${kh[@]}" $i ) done for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do diff -Nurd bash-completion-1.3/completions/Makefile.am bash-completion-1.3-new/completions/Makefile.am --- bash-completion-1.3/completions/Makefile.am 2011-01-21 04:36:11.000000000 -0500 +++ bash-completion-1.3-new/completions/Makefile.am 2011-04-28 18:10:45.000000000 -0400 @@ -33,6 +33,7 @@ cvs \ cvsps \ dd \ + defaults \ dhclient \ dict \ dpkg \ @@ -72,6 +73,7 @@ k3b \ kldload \ larch \ + launchctl \ ldapvi \ lftp \ lilo \ @@ -105,6 +107,7 @@ net-tools \ nmap \ ntpdate \ + open \ openldap \ openssl \ open-iscsi \ @@ -177,7 +180,8 @@ xsltproc \ xz \ yp-tools \ - yum-arch + yum-arch \ + xcodebuild EXTRA_DIST = $(bashcomp_DATA) \ _mock _modules _subversion _yum _yum-utils diff -Nurd bash-completion-1.3/completions/Makefile.in bash-completion-1.3-new/completions/Makefile.in --- bash-completion-1.3/completions/Makefile.in 2011-02-06 14:16:21.000000000 -0500 +++ bash-completion-1.3-new/completions/Makefile.in 2011-04-28 18:11:02.000000000 -0400 @@ -216,6 +216,7 @@ cvs \ cvsps \ dd \ + defaults \ dhclient \ dict \ dpkg \ @@ -224,6 +225,7 @@ dvd+rw-tools \ e2fsprogs \ findutils \ + fink \ freeciv \ freerdp \ fuse \ @@ -255,6 +257,7 @@ k3b \ kldload \ larch \ + launchctl \ ldapvi \ lftp \ lilo \ @@ -288,6 +291,7 @@ net-tools \ nmap \ ntpdate \ + open \ openldap \ openssl \ open-iscsi \ @@ -360,7 +364,8 @@ xsltproc \ xz \ yp-tools \ - yum-arch + yum-arch \ + xcodebuild EXTRA_DIST = $(bashcomp_DATA) \ _mock _modules _subversion _yum _yum-utils diff -Nurd bash-completion-1.3/completions/apt bash-completion-1.3-new/completions/apt --- bash-completion-1.3/completions/apt 2011-01-21 04:36:11.000000000 -0500 +++ bash-completion-1.3-new/completions/apt 2011-04-28 18:11:02.000000000 -0400 @@ -17,7 +17,7 @@ if [ -n "$special" ]; then case $special in remove|autoremove|purge) - if [ -f /etc/debian_version ]; then + if [ -f /etc/debian_version ] || [ -x "@FINKPREFIX@/bin/fink" ]; then # Debian system COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) ) else diff -Nurd bash-completion-1.3/completions/aptitude bash-completion-1.3-new/completions/aptitude --- bash-completion-1.3/completions/aptitude 2011-01-21 04:36:11.000000000 -0500 +++ bash-completion-1.3-new/completions/aptitude 2011-04-28 18:11:02.000000000 -0400 @@ -9,7 +9,7 @@ } || { _comp_dpkg_hold_packages() { - command grep -B 2 'hold' /var/lib/dpkg/status | \ + command grep -B 2 'hold' @FINKPREFIX@/var/lib/dpkg/status | \ command grep "Package: $1" | cut -d\ -f2 } } diff -Nurd bash-completion-1.3/completions/defaults bash-completion-1.3-new/completions/defaults --- bash-completion-1.3/completions/defaults 1969-12-31 19:00:00.000000000 -0500 +++ bash-completion-1.3-new/completions/defaults 2011-04-28 18:10:45.000000000 -0400 @@ -0,0 +1,175 @@ +# defaults +# Bash command line completion for defaults +# +# Created by Jonathon Mah on 2006-11-08. +# Copyright 2006 Playhaus. All rights reserved. +# +# This file is licensed under the BSD license, as follows: +# +# Copyright (c) 2006, Playhaus +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Playhaus nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# This software is provided by the copyright holders and contributors "as is" +# and any express or implied warranties, including, but not limited to, the +# implied warranties of merchantability and fitness for a particular purpose are +# disclaimed. In no event shall the copyright owner or contributors be liable +# for any direct, indirect, incidental, special, exemplary, or consequential +# damages (including, but not limited to, procurement of substitute goods or +# services; loss of use, data, or profits; or business interruption) however +# caused and on any theory of liability, whether in contract, strict liability, +# or tort (including negligence or otherwise) arising in any way out of the use +# of this software, even if advised of the possibility of such damage. +# +# Version 1.0 (2006-11-08) + +[ $UNAME = Darwin ] && have defaults && +{ +_defaults_domains() +{ + local cur + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + + local domains=$( defaults domains | sed -e 's/, /:/g' | tr : '\n' | sed -e 's/ /\\ /g' | grep -i "^$cur" ) + local IFS=$'\n' + COMPREPLY=( $domains ) + if [[ $( echo '-app' | grep "^$cur" ) ]]; then + COMPREPLY[${#COMPREPLY[@]}]="-app" + fi + + return 0 +} + + +_defaults() +{ + local cur prev host_opts cmds cmd domain keys key_index + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + + host_opts='-currentHost -host' + cmds='read read-type write rename delete domains find help' + + if [[ $COMP_CWORD -eq 1 ]]; then + COMPREPLY=( $( compgen -W "$host_opts $cmds" -- $cur ) ) + return 0 + elif [[ $COMP_CWORD -eq 2 ]]; then + if [[ "$prev" == "-currentHost" ]]; then + COMPREPLY=( $( compgen -W "$cmds" -- $cur ) ) + return 0 + elif [[ "$prev" == "-host" ]]; then + return 0 + _known_hosts -a + else + _defaults_domains + return 0 + fi + elif [[ $COMP_CWORD -eq 3 ]]; then + if [[ ${COMP_WORDS[1]} == "-host" ]]; then + _defaults_domains + return 0 + fi + fi + + # Both a domain and command have been specified + + if [[ ${COMP_WORDS[1]} == @(${cmds// /|}) ]]; then + cmd=${COMP_WORDS[1]} + domain=${COMP_WORDS[2]} + key_index=3 + if [[ "$domain" == "-app" ]]; then + if [[ $COMP_CWORD -eq 3 ]]; then + # Completing application name. Can't help here, sorry + return 0 + fi + domain="-app ${COMP_WORDS[3]}" + key_index=4 + fi + elif [[ ${COMP_WORDS[2]} == "-currentHost" ]] && [[ ${COMP_WORDS[2]} == @(${cmds// /|}) ]]; then + cmd=${COMP_WORDS[2]} + domain=${COMP_WORDS[3]} + key_index=4 + if [[ "$domain" == "-app" ]]; then + if [[ $COMP_CWORD -eq 4 ]]; then + # Completing application name. Can't help here, sorry + return 0 + fi + domain="-app ${COMP_WORDS[4]}" + key_index=5 + fi + elif [[ ${COMP_WORDS[3]} == "-host" ]] && [[ ${COMP_WORDS[3]} == @(${cmds// /|}) ]]; then + cmd=${COMP_WORDS[3]} + domain=${COMP_WORDS[4]} + key_index=5 + if [[ "$domain" == "-app" ]]; then + if [[ $COMP_CWORD -eq 5 ]]; then + # Completing application name. Can't help here, sorry + return 0 + fi + domain="-app ${COMP_WORDS[5]}" + key_index=6 + fi + fi + + keys=$( defaults read $domain 2>/dev/null | sed -n -e '/^ [^}) ]/p' | sed -e 's/^ \([^" ]\{1,\}\) = .*$/\1/g' -e 's/^ "\([^"]\{1,\}\)" = .*$/\1/g' | sed -e 's/ /\\ /g' ) + + case $cmd in + read|read-type) + # Complete key + local IFS=$'\n' + COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) ) + ;; + write) + if [[ $key_index -eq $COMP_CWORD ]]; then + # Complete key + local IFS=$'\n' + COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) ) + elif [[ $((key_index+1)) -eq $COMP_CWORD ]]; then + # Complete value type + # Unfortunately ${COMP_WORDS[key_index]} fails on keys with spaces + local value_types='-string -data -integer -float -boolean -date -array -array-add -dict -dict-add' + local cur_type=$( defaults read-type $domain ${COMP_WORDS[key_index]} 2>/dev/null | sed -e 's/^Type is \(.*\)/-\1/' -e's/dictionary/dict/' | grep "^$cur" ) + if [[ $cur_type ]]; then + COMPREPLY=( $cur_type ) + else + COMPREPLY=( $( compgen -W "$value_types" -- $cur ) ) + fi + elif [[ $((key_index+2)) -eq $COMP_CWORD ]]; then + # Complete value + # Unfortunately ${COMP_WORDS[key_index]} fails on keys with spaces + COMPREPLY=( $( defaults read $domain ${COMP_WORDS[key_index]} 2>/dev/null | grep -i "^${cur//\\/\\\\}" ) ) + fi + ;; + rename) + if [[ $key_index -eq $COMP_CWORD ]] || + [[ $((key_index+1)) -eq $COMP_CWORD ]]; then + # Complete source and destination keys + local IFS=$'\n' + COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) ) + fi + ;; + delete) + if [[ $key_index -eq $COMP_CWORD ]]; then + # Complete key + local IFS=$'\n' + COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) ) + fi + ;; + esac + + return 0 +} +complete -F _defaults -o default defaults +} diff -Nurd bash-completion-1.3/completions/dpkg bash-completion-1.3-new/completions/dpkg --- bash-completion-1.3/completions/dpkg 2011-01-21 04:36:11.000000000 -0500 +++ bash-completion-1.3-new/completions/dpkg 2011-04-28 18:11:02.000000000 -0400 @@ -8,7 +8,7 @@ } || { _comp_dpkg_installed_packages() { - command grep -A 1 "Package: $1" /var/lib/dpkg/status | \ + command grep -A 1 "Package: $1" @FINKPREFIX@/var/lib/dpkg/status | \ command grep -B 1 -Ee "ok installed|half-installed|unpacked| \ half-configured|config-files" \ -Ee "^Essential: yes" | \ diff -Nurd bash-completion-1.3/completions/fink bash-completion-1.3-new/completions/fink --- bash-completion-1.3/completions/fink 1969-12-31 19:00:00.000000000 -0500 +++ bash-completion-1.3-new/completions/fink 2011-04-28 18:11:02.000000000 -0400 @@ -0,0 +1,128 @@ +#!/bin/bash + +# +# Copyright (c) 2004, Lukas Westermann +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# - The names of its contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# +# Completion for Fink command +# +# History +# --------------------------------- +# Version 1.0.0 - initial release +# Version 1.0.1 - added test to check fink availability +# Version 1.0.2 - simplified checks for fink availabiltiy +# Version 1.0.3 - fixed problems with spaces in completion +# + +[ $UNAME = Darwin ] && have fink && { +_fink_installed() { + fink list -i --tab "$*" | cut -f2 2>/dev/null +} + +_fink_all() { + apt-cache pkgnames "$*" 2>/dev/null +} + +_fink_trees() { + cat @FINKPREFIX@/etc/fink.conf | sed -e '/^Trees/!d; s/^Trees://' 2>/dev/null +} + +_fink() +{ + local cur prev special i + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + + for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == @(install|update|enable|activate|use|list|remove|disable|deactivate|unuse|delete \ + |purge|apropos|describe|desc|description|info|fetch-missing|fetch \ + |build|rebuild|reinstall|validate|check|scanpackages) ]]; then + special=${COMP_WORDS[i]} + fi + done + + if [ -n "${special}" ]; then + case $special in + install|enable|activate|use|apropos|describe|desc|description|info|fetch|build) + COMPREPLY=( $( _fink_all $cur ) ) + ;; + remove|disable|deactivate|unuse|delete|purge|update|rebuild|reinstall) + COMPREPLY=( $( _fink_installed $cur ) ) + ;; + fetch-missing) + COMPREPLY=( $( compgen -W '-i --ignore-restrictive' -- $cur ) ) + ;; + validate|check) + local IFS=$'\t\n' + _filedir '@(deb|info)' + #COMPREPLY=( $( compgen -f -- $cur ) ) + ;; + scanpackages) + COMPREPLY=( $( compgen -W '$( _fink_trees )' -- $cur ) ) + ;; + list) + if [[ "$cur" == -* ]]; then + # TODO: Fix problems with --tree= + #if [[ $cur == --tree=* || $cur == -t=* ]]; then + #local pfx las #res + #pfx=$( echo $cur | sed -e 's/^\([^=]*\)=.*$/\1/' ) + #las=$( echo "$cur" | sed -e 's/^[^=]*=//' ) + #[[ $las == $cur ]] && las=() + #res=$( cat @FINKPREFIX@/etc/fink.conf | sed -e '/^Trees/!d; s/^Trees://' 2>/dev/null ) + #COMPREPLY=( $( compgen -W '$( _fink_trees )' -- "${las}" ) ) + #else + COMPREPLY=( $( compgen -W '-h --help -t --tab -i --installed -o --outdated -u --uptodate -n --notinstalled \ + -s --section -m --maintainer --tree -w --width' -- $cur ) ) + #fi + else + COMPREPLY=( $( _fink_all $cur ) ) + fi + ;; + esac + + return 0 + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-h -q -V -v -y --help --quite --version --verbose --yes' -- $cur ) ) + else + COMPREPLY=( $( compgen -W 'install remove purge update selfupdate update-all configure list \ + apropos describe fetch fetch-all fetch-missing index validate scanpackages \ + build rebuild reinstall checksums cleanup' -- $cur ) ) + fi + + return 0 +} +complete $filenames -F _fink fink +} diff -Nurd bash-completion-1.3/completions/launchctl bash-completion-1.3-new/completions/launchctl --- bash-completion-1.3/completions/launchctl 1969-12-31 19:00:00.000000000 -0500 +++ bash-completion-1.3-new/completions/launchctl 2011-04-28 18:10:45.000000000 -0400 @@ -0,0 +1,171 @@ +# ex: filetype=sh et sw=4 +# +# launchctl(1) completion +# +[ $UNAME = Darwin ] && have launchctl && +{ +_launchctl() +{ + local cur oslevel + + oslevel=${OSTYPE//darwin/} + oslevel=${oslevel%%.*} + + COMPREPLY=() + cur=`_get_cword` + + if [[ $COMP_CWORD -eq 1 ]]; then + local commands + + commands="load unload start stop list setenv unsetenv \ + getenv export limit shutdown getrusage log umask help" + + if [[ $oslevel -le 8 ]]; then + commands+=" reloadttys stdout stderr" + fi + + if [[ $oslevel -ge 9 ]]; then + commands+=" submit remove bootstrap singleuser bsexec bslist" + if [[ $oslevel -ge 10 ]]; then + commands+=" bstree managerpid manageruid managername" + fi + fi + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) + else + local command + command=${COMP_WORDS[1]} + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$command" in + load|unload) + case $prev in + -S) + COMPREPLY=( $( compgen -W "Aqua LoginWindow Background StandardIO System" -- $cur ) ) + ;; + -D) + COMPREPLY=( $( compgen -W "system local network all user" -- $cur ) ) + ;; + *) + opts="-w" + if [[ $oslevel -ge 0 ]]; then + opts+=" -S -D" + if [[ $command = load ]]; then + opts+=" -F" + fi + fi + COMPREPLY=( $( compgen -f -W "$opts" -- $cur ) ) + ;; + esac + ;; + start|stop|remove|list) + local jobs opts + + if [[ $command != list || $oslevel -ge 9 ]]; then + if [[ $oslevel -le 8 ]]; then + jobs="$( launchctl list )" + else + jobs="$( launchctl list | awk 'NR>1 { print $3 }')" + if [[ $oslevel -ge 10 && $command = list ]]; then + opts="-x" + fi + fi + fi + COMPREPLY=( $( compgen -W "$jobs $opts" -- $cur ) ) + ;; + getenv|setenv|unsetenv) + if [[ $COMP_CWORD -eq 2 ]]; then + envvars="$( launchctl export | cut -f1 -d= )" + COMPREPLY=( $( compgen -W "$envvars" -- $cur ) ) + fi + ;; + getrusage) + if [[ $COMP_CWORD -eq 2 ]]; then + COMPREPLY=( $( compgen -W "self children" -- $cur ) ) + fi + ;; + limit) + if [[ $COMP_CWORD -eq 2 ]]; then + local limits + limits="$( launchctl limit | awk '{print $1}' )" + COMPREPLY=( $( compgen -W "$limits" -- $cur ) ) + fi + ;; + log) + if [[ $COMP_CWORD -eq 2 ]]; then + COMPREPLY=( $( compgen -W "level only mask" -- $cur ) ) + else + local level + levels="debug info notice warning error critical alert emergency" + case ${COMP_WORDS[2]} in + level) + if [[ $COMP_CWORD -eq 3 ]]; then + COMPREPLY=( $( compgen -W "$levels" -- $cur ) ) + fi + ;; + mask|only) + COMPREPLY=( $( compgen -W "$levels" -- $cur ) ) + ;; + esac + fi + ;; + stdout|stderr) + # Darwin 8 only + if [[ $oslevel -le 8 ]]; then + _filedir + fi + ;; + submit) + local i + i=1 + while [[ $i -lt ${#COMP_WORDS[@]} ]]; do + if [[ "${COMP_WORDS[i-1]}" = "--" ]]; then + _command_offset $i + return 0 + fi + i=$((i+1)) + done + + local submit_opts + submit_opts="-l -p -o -e --" + case $prev in + -l) + ;; + -p) + _command_offset $COMP_CWORD + ;; + -o|-e) + _filedir + ;; + *) + COMPREPLY=( $( compgen -W "$submit_opts" -- $cur ) ) + ;; + esac + + ;; + bslist) + local pids opts + pids=$( ps axo pid= ) + [[ $oslevel -ge 10 ]] && opts="-j" + COMPREPLY=( $( compgen -W "$pids $opts" -- $cur ) ) + ;; + bsexec) + if [[ $COMP_CWORD -eq 2 ]]; then + local pids + pids=$( ps axo pid= ) + COMPREPLY=( $( compgen -W "$pids" -- $cur ) ) + else + _command_offset 3 + fi + ;; + bstree) + if [[ $oslevel -ge 10 ]]; then + COMPREPLY=( $( compgen -W "-j" -- $cur ) ) + fi + ;; + esac + fi + + return 0 +} +complete -F _launchctl $filenames launchctl +} diff -Nurd bash-completion-1.3/completions/open bash-completion-1.3-new/completions/open --- bash-completion-1.3/completions/open 1969-12-31 19:00:00.000000000 -0500 +++ bash-completion-1.3-new/completions/open 2011-04-28 18:30:08.000000000 -0400 @@ -0,0 +1,104 @@ +# +# Copyright (c) 2004, Lukas Westermann +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# - The names of its contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# +# Bash Auto-Completion for the NextStep command 'open' +# +# History +# ---------------------------------- +# Version 1.0.0 - initial release +# Version 1.0.1 - added test for availabilty (Darwin only +# and check for open) +# Version 1.0.2 - fixed problems with IFS for -a and -e +# Version 1.0.3 - simplified availability check +# Version 1.0.4 - fixed problem with spaces and completion +# + +[ $UNAME = Darwin ] && have open && { +_list_apps() { + local IFS=$'\n' + find '/Applications' "${HOME}"'/Applications' '/Developer/Applications' -name "${1}*.app" -maxdepth 2 2>/dev/null + #TODO: MS Word and other carbon apps...HOW ??? +} + +_open() +{ + + local cur prev IFS=$'\t\n' + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $prev == -a ]]; then + local res ncur + ncur=$( echo "$cur" | sed -e 's/\\//g' 2>/dev/null ) + res=$( _list_apps "${ncur}" | sed -e 's/.*\/\([^\/]*\)\.app/\1/' ) + COMPREPLY=( $( compgen -W "${res}" -- "${ncur}" | sed -e 's/ /\\ /g' ) ) + elif [[ $prev == -e ]]; then + _filedir '@(txt|doc|rtf|rtfd|pdf|png|jpg|gif)' + elif [[ $cur == -* ]]; then + local IFS=$' \t\n' + COMPREPLY=( $( compgen -W '-a -e' -- "$cur" ) ) + else + local first="${COMP_WORDS[1]}" second="${COMP_WORDS[2]}" + if [[ $first == -a ]]; then + case "$second" in + QuickTime*) + _filedir '@(mp3|mpg|mpeg|avi|m4*|mov|alc)' + ;; + iTunes) + _filedir '@(mp3|m4*|ogg|alc)' + ;; + Safari|Mozilla|Camino|Opera|Firebird) + # TODO: complete from history/bookmarks ? + _filedir '@(htm|html|xhtm|xhtml|php|php3|php3|xml)' + ;; + VLC) + # TODO: complete for CD/DVD too... + _filedir '@(avi|mpg)' + ;; + BitTorrent*) + _filedir '@(torrent)' + ;; + *) + # others, complete all + _filedir + ;; + esac + else + _filedir + fi + fi + +} +complete $filenames -F _open open +} diff -Nurd bash-completion-1.3/completions/openssl bash-completion-1.3-new/completions/openssl --- bash-completion-1.3/completions/openssl 2011-01-21 04:36:11.000000000 -0500 +++ bash-completion-1.3-new/completions/openssl 2011-04-28 18:11:08.000000000 -0400 @@ -15,8 +15,8 @@ # if no config given, check some usual default locations if [ -z "$config" ]; then - for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \ - /usr/share/ssl/openssl.cnf; do + for f in @FINKPREFIX@/etc/ssl/openssl.cnf \ + /System/Library/OpenSSL/openssl.cnf; do [ -f $f ] && config=$f && break done fi diff -Nurd bash-completion-1.3/completions/procps bash-completion-1.3-new/completions/procps --- bash-completion-1.3/completions/procps 2011-01-21 04:36:11.000000000 -0500 +++ bash-completion-1.3-new/completions/procps 2011-04-28 18:11:08.000000000 -0400 @@ -2,7 +2,7 @@ # killall(1) (Linux and FreeBSD) and pkill(1) completion. # -[[ $UNAME == Linux || $UNAME == FreeBSD ]] || have pkill && +have killall || have pkill && _killall() { local cur @@ -18,7 +18,7 @@ return 0 } -[[ $UNAME == Linux || $UNAME == FreeBSD ]] && complete -F _killall killall +have killall && complete -F _killall killall have pkill && complete -F _killall pkill # pgrep(1) completion. diff -Nurd bash-completion-1.3/completions/update-alternatives bash-completion-1.3-new/completions/update-alternatives --- bash-completion-1.3/completions/update-alternatives 2011-01-21 04:36:11.000000000 -0500 +++ bash-completion-1.3-new/completions/update-alternatives 2011-04-28 18:11:08.000000000 -0400 @@ -7,6 +7,7 @@ # find the admin dir for i in alternatives dpkg/alternatives rpm/alternatives; do [ -d /var/lib/$i ] && admindir=/var/lib/$i && break + [ -d "@FINKPREFIX@/etc/$i" ] && admindir="@FINKPREFIX@/etc/$i" && break done for (( i=1; i < COMP_CWORD; i++ )); do if [[ "${COMP_WORDS[i]}" == --admindir ]]; then diff -Nurd bash-completion-1.3/completions/xcodebuild bash-completion-1.3-new/completions/xcodebuild --- bash-completion-1.3/completions/xcodebuild 1969-12-31 19:00:00.000000000 -0500 +++ bash-completion-1.3-new/completions/xcodebuild 2011-04-28 18:10:45.000000000 -0400 @@ -0,0 +1,91 @@ +# xcodebuild +# Bash command line completion for xcodebuild +# +# Created by Jonathon Mah on 2006-11-08. +# Copyright 2006 Playhaus. All rights reserved. +# +# This file is licensed under the BSD license, as follows: +# +# Copyright (c) 2006, Playhaus +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Playhaus nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# This software is provided by the copyright holders and contributors "as is" +# and any express or implied warranties, including, but not limited to, the +# implied warranties of merchantability and fitness for a particular purpose are +# disclaimed. In no event shall the copyright owner or contributors be liable +# for any direct, indirect, incidental, special, exemplary, or consequential +# damages (including, but not limited to, procurement of substitute goods or +# services; loss of use, data, or profits; or business interruption) however +# caused and on any theory of liability, whether in contract, strict liability, +# or tort (including negligence or otherwise) arising in any way out of the use +# of this software, even if advised of the possibility of such damage. +# +# Version 1.0 (2006-11-08) + +[ $UNAME = Darwin ] && have xcodebuild && +{ +_xcodebuild() +{ + local cur prev #cmds cmdOpts optsParam opt helpCmds optBase i + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + + cmds='-project -activetarget -alltargets -target -activeconfiguration -configuration -version -list -help build installsrc install clean' + + if [[ "$prev" = "-project" ]]; then + # Show list of projects + local projects=$( compgen -X "${1:+"!*.xcodeproj"}" -d | sed -e 's/ /\\ /g' ) + local IFS=$'\n' + COMPREPLY=( $( echo "$projects" | grep "^$cur" ) ) + elif [[ "$prev" = "-target" ]]; then + local arg project_args is_project_next + is_project_next="false" + for arg in ${COMP_WORDS} ; do + if [[ "$is_project_next" = "true" ]]; then + project_args="-project $arg" + break + elif [[ "$arg" = "-project" ]]; then + is_project_next="true" + fi + done + cur=$(printf '%q' "$cur" ) + local targets=$(xcodebuild $project_args -list | sed -n -e '/^ Targets:$/,/^$/p' | sed -e '1d' -e '$d' -e 's/^[[:space:]]*//' -e 's/ (Active)$//' -e 's/ /\\ /g' | grep "^$cur" ) + local IFS=$'\n' + COMPREPLY=( $targets ) + elif [[ "$prev" = "-configuration" ]]; then + local arg project_args is_project_next + is_project_next="false" + for arg in ${COMP_WORDS} ; do + if [[ "$is_project_next" = "true" ]]; then + project_args="-project $arg" + break + elif [[ "$arg" = "-project" ]]; then + is_project_next="true" + fi + done + cur=$(printf '%q' "$cur" ) + local configurations=$(xcodebuild $project_args -list | sed -n -e '/^ Build Configurations:$/,/^$/p' | sed -e '1d' -e '$d' -e 's/^[[:space:]]*//' -e 's/ (Active)$//' -e 's/ /\\ /g' | grep "^$cur" ) + local IFS=$'\n' + COMPREPLY=( $configurations ) + else + COMPREPLY=( $( compgen -W "$cmds" -- $cur ) ) + fi + + return 0 +} +complete -F _xcodebuild xcodebuild +} --- bash-completion-1.3/bash_completion.sh.in.orig 2014-06-06 13:36:30.000000000 -0400 +++ bash-completion-1.3/bash_completion.sh.in 2014-06-06 13:36:46.000000000 -0400 @@ -3,7 +3,7 @@ # Check for recent enough version of bash. bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} -if [ $bmajor -gt 3 ] || [ $bmajor -eq 3 -a $bminor -ge 2 ]; then +if [ $bmajor -eq 3 ] || [ $bmajor -eq 3 -a $bminor -ge 2 ]; then if shopt -q progcomp && [ -r @sysconfdir@/bash_completion ]; then # Source completion code. . @sysconfdir@/bash_completion