Mac Bash Completion is package providing command-line completion for a number of Mac-specific tools in the Bash shell. The commands are described in detail below.
Copy the command completion files to a common location:
% mkdir -p ~/Library/init/bash/completion % cp completion/* ~/Library/init/bash/completion/
Copy Bonjour Lister to somewhere in your path:
% sudo cp Bonjour\ Lister\ 1.0/blister /usr/bin/
Then source them from your .bashrc or .bash_profile. This example first loads the bash-completion package installed through MacPorts.
# Set up completions if [ -f /opt/local/etc/bash_completion ]; then source /opt/local/etc/bash_completion for cmd in ~/Library/init/bash/completion/* ; do source $cmd done fi
Completion for defaults will fill in all command options, domains, and keys. Additionally, defaults write will insert the current value and type. Here's a text example until I put up a video:
% defaults w <tab> % defaults write com.apple.te <tab> com.apple.Terminal com.apple.TextEdit % defaults write com.apple.Terminal nsfi <tab> NSFixedPitchFont NSFixedPitchFontSize % defaults write com.apple.Terminal NSFixedPitchFontSize <tab><tab> % defaults write com.apple.Terminal NSFixedPitchFontSize -integer 9
SSH completion is a small enhancement on the existing bash-completion. The bash-completion package is used to complete some arguments and known hosts. The Mac Bash Completion package adds completion of local Bonjour hosts, and suppresses unavailable *.local hosts. Bonjour Lister is used to find local hosts.
The xcodebuild command builds Xcode proejcts from the command line. All options and commands are completed, including the project's targets and configurations.
% ls Bonjour Lister.xcodeproj/ _darcs/ main.c LICENSE.txt build/ % xcodebuild <tab> -activeconfiguration -help -version installsrc -activetarget -list build -alltargets -project clean -configuration -target install % xcodebuild -proj <tab><tab> % xcodebuild -project Bonjour\ Lister.xcodeproj -conf <tab><tab> Debug Release % xcodebuild -project Bonjour\ Lister.xcodeproj -configuration Release -t <tab><tab> % xcodebuild -project Bonjour\ Lister.xcodeproj -configuration Release -target Bonjour\ Lister
defaults, ssh, xcodebuild)Mac Bash Completion is licensed under the BSD license, as follows:
Copyright © 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:
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.