cdup/shell/
bash.rs

1/// Integration script template for bash
2pub const SCRIPT: &str = "\
3# Put the line below in ~/.bashrc or ~/bash_profile:
4#
5#   eval \"$(cdup init bash)\"
6
7{alias}() {
8  local dir=$(command cdup cd \"${*:-1}\")
9  test -d \"$dir\" && cd \"$dir\"
10}
11
12__cdup_hint() {
13  local term=\"${COMP_LINE/#{alias} /}\"
14  if [[ -z ${term} ]]; then
15      COMPREPLY=($(command cdup hint))
16  else
17      COMPREPLY=($(command cdup hint \"$term\"))
18  fi
19}
20
21complete -F __cdup_hint {alias}
22";