Last active
August 29, 2015 13:58
-
-
Save preaction/9941797 to your computer and use it in GitHub Desktop.
Space too soon? Space too late? Don't let your over-zealous spacebar thumbing get in the way of Getting Work Done! Link these files as "space-too-soon -> gi" and "space-too-late -> gitp" to make "gi tpush" and "gitp ush" work correctly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Space too late. Run the command you wanted to run but you hit the space bar one | |
# character too late | |
# | |
# Usage: | |
# ln -s space-too-late gitp | |
# gitp ush | |
# gitc ommit | |
# | |
# Unlike its counterpart, space too soon, this one must be named differently based | |
# on which misspelling you frequently have | |
MISSPELLED=$(basename $0) | |
LETTER=${MISSPELLED: -1} # Space before '-1' is important! | |
COMMAND=${MISSPELLED:0:${#MISSPELLED}-1} | |
echo "!!! Space too late! Executing: $COMMAND ${LETTER}$@" | |
exec $COMMAND ${LETTER}$@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Space too soon. Run the command you wanted to run but you hit the space bar one | |
# character too soon. | |
# | |
# Usage: | |
# ln -s space-too-soon gi | |
# gi tpush | |
# gi tcommit | |
MISSPELLED=$1 | |
shift | |
LETTER=${MISSPELLED:0:1} | |
REST=${MISSPELLED:1} | |
# Use basename to ensure looking in PATH again | |
# $0 is the full path to this script | |
COMMAND="$(basename $0)$LETTER" | |
echo "!!! Space too soon! Executing: $COMMAND $REST $@" | |
exec $COMMAND $REST $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment