Create Custom Command Lines

$ These are some common bash command lines I used for personal works. I really hate to remember the commands in details, so I usually create functions in .bash_profile. Below are some examples:

v_proxy_set() {
  echo "Configuring proxy ..."
  export ALL_PROXY=[my proxy config]
  export HTTP_PROXY=${ALL_PROXY}
  export HTTPS_PROXY=${ALL_PROXY}
  export NO_PROXY=localhost,127.0.0.1
}

v_proxy_unset() {
  echo "Removing proxy configuration ..."
  unset ALL_PROXY
  unset HTTP_PROXY
  unset HTTPS_PROXY
  unset NO_PROXY
}

v_java_home_set() {
  export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
  export PATH=$JAVA_HOME/bin:$PATH
  export PATH="/usr/local/opt/node@8/bin:$PATH"
}

v_nodejs_home_set() {
  export PATH="/usr/local/opt/node@8/bin:$PATH"
}

v_aliases_set() {
  alias dk='docker'
  alias dkc='docker-compose'
  alias gs='git status'
  alias gc='git checkout'
  alias gcm='git checkout master'
  alias ll='ls -lthar'
  alias df='df -H'
  alias du='du -ch'
}

v_aes_decode() {
  echo $1
  echo "$1" | openssl aes-256-cbc -a -d
}

v_aes_encode() {
  echo $1 | openssl aes-256-cbc -a -e
}

v_git_repos_updates() {
  echo "Updating all git repos in current folder ${PWD}"
  FILES==$(ls)
  ROOT_DIR=$(pwd)
  for i in $FILES; do
    if [ -d $i ]; then
      cd $i
      if [ -d .git ]; then
        echo "[+] Updating $(pwd)"
        git fetch --all
      fi
      cd $ROOT_DIR
    fi
  done
}

When I need to set proxy on my laptop. I just need to execute command v_proxy_set.

Do I need to remember all of my custom command lines. The answer is NO. I just need to type v_ and then tab, the terminal will display all of my custom commands which I can use.

Just in case you wonder what is v_ in my commands stands for, it's my name "Vincent".