Merge pull request #312 from RichardLitt/feature/concat-extra-feature-names

Added in option to concat extra feature names.
This commit is contained in:
hemanth.hm 2015-03-08 23:36:41 +05:30
commit a48402153b

View file

@ -1,5 +1,14 @@
#!/usr/bin/env bash
concatargs(){
delim='-'
str=
for i in "$@"; do
str="$str$delim$i"
done
branch=feature/${str:1}
}
if test "$1" = "finish"; then
test -z $2 && echo "feature <name> required." 1>&2 && exit 1
branch=feature/$2
@ -7,9 +16,10 @@ if test "$1" = "finish"; then
else
test -z $1 && echo "feature <name> required." 1>&2 && exit 1
if test -n "$2"; then
echo "too many arguments; if not finishing a feature, only <name> of new feature is expected" && exit 1
concatargs ${@:2}
else
branch=feature/$1
fi
branch=feature/$1
git checkout -b $branch &> /dev/null
test -n $? && git checkout $branch &> /dev/null
fi