Skip to content

Instantly share code, notes, and snippets.

@azu
Created May 21, 2018 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azu/650d955b35c8ba2cebf3e542dd3964c1 to your computer and use it in GitHub Desktop.
Save azu/650d955b35c8ba2cebf3e542dd3964c1 to your computer and use it in GitHub Desktop.
mkdev: ghq + mkdir
mkdev () {
if [ ! -n "$1" ]
then
echo "Usage: mkdev dir-name"
return
fi
local dirName=$1
local rootDir=$(ghq root)
local githubUser="github.com/$(git config user.name)"
if echo "${dirName}" | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} -q "/"
then
githubUser="github.com"
fi
local devPath="${rootDir}/${githubUser}/${dirName}"
mkdir -p ${devPath}
__enhancd::cd ${devPath}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment