Created
June 20, 2019 21:58
-
-
Save kvendrik/a3b14dc31df3c76ccdc838eb750758b4 to your computer and use it in GitHub Desktop.
Medium Article: repositories code from dotfiles
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
autoload bashcompinit | |
bashcompinit | |
$REPOSITORIES_DIRECTORY='~/repos' | |
function re() { | |
[ -z "$1" ] && echo "$REPOSITORIES_DIRECTORY" || echo "$REPOSITORIES_DIRECTORY/$1" | |
} | |
function r() { | |
cd "$(re "$1")" || return | |
} | |
function __r_autocomplete() { | |
complete -W "$(ls "$REPOSITORIES_DIRECTORY")" "$1" | |
} | |
__r_autocomplete re | |
__r_autocomplete r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment