function jd() {
    cd "$@"
}

function _jd() {
  if [[ ${COMP_WORDS[COMP_CWORD]} != -* ]] ; then
    COMPREPLY=( `jd.py 5 ${COMP_WORDS[COMP_CWORD]}` )
    return 0
  fi
}

complete -F _jd jd

function jd() {
    cd "$@"
}

function _jd() {
  if [[ ${COMP_WORDS[COMP_CWORD]} != -* ]] ; then
    COMPREPLY=( `jd.py ${JD_DEPTH:=5} ${COMP_WORDS[COMP_CWORD]}` )
    return 0
  fi
}

complete -F _jd jd

Set search depth with $JD_DEPTH
Set search depth with $JD_DEPTH

Default value is 5
