Created
May 21, 2018 15:53
-
-
Save azu/650d955b35c8ba2cebf3e542dd3964c1 to your computer and use it in GitHub Desktop.
mkdev: ghq + mkdir
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
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