Skip to content

Instantly share code, notes, and snippets.

@esamson
Created February 19, 2015 09:33
Show Gist options
  • Save esamson/bd7ed1720461b985c377 to your computer and use it in GitHub Desktop.
Save esamson/bd7ed1720461b985c377 to your computer and use it in GitHub Desktop.
OpenDJ subcommands -- instead of adding everything to your PATH
#!/bin/bash
OPENDJ_HOME=~/.local/opt/opendj
if [ -z "$1" ] ; then
echo "Usage: $0 <command>"
echo
echo "Where <command> is one of:"
echo
ls -1 $OPENDJ_HOME/bin
exit 1
fi
$OPENDJ_HOME/bin/$*
# Add to ~/.bashrc to get bash completion
_opendj()
{
local cur opts
cur=${COMP_WORDS[COMP_CWORD]}
opts=`ls $HOME/.local/opt/opendj/bin`
COMPREPLY=( $(compgen -W "${opts}" -- $cur) )
}
complete -F _opendj opendj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment