bash - How to prevent git from quitting when I use TAB completion? -


i want git require confirmation resetting, updated william pursell's suggestion written here this:

git() { set -e -u if [ $# -ge 2 ];     if [ "x$1" = "xreset" -a "x$2" = "x--hard" ];         echo "are sure? (type 'yes')"         read resp || return $?         if [ "x$resp" = "xyes" ];             echo "resetting"         else                             echo "not resetting"             return 0         fi     fi fi command git "$@" || : } 

with won't quit console if mistype command, still quits if try use tab completion. there way prevent this?

remove line set -e -u. settings global shell session, not local function, , conflict shell completion functions not immune undefined variables (set -u). , since function written, need neither set -e nor set -u.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -