Skip to content

Instantly share code, notes, and snippets.

@kvendrik
Created June 20, 2019 21:58
Show Gist options
  • Save kvendrik/a3b14dc31df3c76ccdc838eb750758b4 to your computer and use it in GitHub Desktop.
Save kvendrik/a3b14dc31df3c76ccdc838eb750758b4 to your computer and use it in GitHub Desktop.
Medium Article: repositories code from dotfiles
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