Skip to content

Commit 3768961

Browse files
author
Adam Simpson
committed
feat: add function to checkout new git branch
remove old project-init function
1 parent fc30a68 commit 3768961

File tree

1 file changed

+3
-63
lines changed

1 file changed

+3
-63
lines changed

bash/functions

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -85,67 +85,7 @@ function hg {
8585
history | grep --color=auto $1
8686
}
8787

88-
# function parse_git_branch {
89-
# git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/'
90-
# }
91-
92-
# function proml {
93-
# local BLUE="\[\033[0;34m\]"
94-
# local DEFAULT="\[\033[0m\]"
95-
# local CYAN="\e[36m"
96-
# local RED="\e[31m"
97-
# local BLACK="\e[30m"
98-
# local GREEN="\e[32m"
99-
# local YELLOW="\e[33m"
100-
# local BLUE="\e[34m"
101-
# local MAGENTA="\e[35m"
102-
# local WHITE="\e[37m"
103-
104-
# PS1="$DEFAULT\u: $DEFAULT\w $YELLOW\$(parse_git_branch) \n⚡ $DEFAULT"
105-
# }
106-
# proml
107-
108-
# #⇒ ➥ ⇾ ⇀ ➤ ❖ ★ ➔ 🔅💩🚀⚡
109-
110-
function sb_init {
111-
local RED="\033[0;31m"
112-
local NC="\033[0m"
113-
114-
if [ ! $# = 1 ]; then
115-
echo -e "${RED}Please specify a project name, or action (update, revert).${NC}"
116-
echo -e "Usage: init project-name / action\n"
117-
fi
118-
if [ "$1" = "--update" ]; then
119-
local name=$(node -e "console.log(require('./package.json').name)");
120-
mv package.json package.bak.json;
121-
mv node_modules node_modules_bak;
122-
curl -sSOL http://raw.github.com/sparkbox/project-init/master/package.json;
123-
sed -i.tmp "s/Project-Name/$name/g" package.json;
124-
rm package.json.tmp;
125-
npm install;
126-
fi
127-
if [ "$1" = "--revert" ]; then
128-
if [ -e node_modules_bak -a -e package.bak.json ]; then
129-
rm -r node_modules;
130-
rm package.json;
131-
mv node_modules_bak node_modules;
132-
mv package.bak.json package.json;
133-
fi
134-
else
135-
echo -e "${RED}Downloading project-init${NC} 🚀\n"
136-
curl -s -S -O -L http://github.com/sparkbox/project-init/archive/master.zip;
137-
echo -e "${RED}Download finished.${NC}\n"
138-
echo -e "${RED}Setting up project config files.${NC}\n"
139-
unzip -qq master.zip;
140-
rm master.zip;
141-
mv project-init-master $1
142-
sed -i.bak "s/Project-Name/$1/g" $1/package.json;
143-
rm $1/package.json.bak;
144-
sed -i.bak "s/Project-Name/$1/g" $1/.rvmrc;
145-
rm $1/.rvmrc.bak;
146-
cd $1
147-
npm install;
148-
bundle;
149-
echo -e "${RED}Your project is all ready to go. Enjoy${NC}\n"
150-
fi
88+
function nb() {
89+
name=$1;
90+
git checkout -b ${name} origin/${name};
15191
}

0 commit comments

Comments
 (0)