Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow directory in templates

  • Loading branch information...
commit 05e07543e72f30b0e6185f39d56408275d6d2c85 1 parent 420a4ed
@dominictarr authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 gen.sh
View
12 gen.sh
@@ -11,6 +11,7 @@ dirname=`basename $dir`
if [ "$name" = -f ]; then
name=''
fi
+
if [ "x$name" = x ]; then
name=$dirname
arg=$2
@@ -52,10 +53,15 @@ add () {
}
init () {
- for file in `ls ~/.gen/default/ -1A`; do
+ type="$1"
+ [ "x$type" = x ] && type=default
+ for file in `ls ~/.gen/$type/ -1A`; do
copyTo=`basename $file`
- test -f "$copyTo" ||
- gen-template --name "$name" < ~/.gen/default/$file > $copyTo
+
+ test -d ~/.gen/$type/$file && mkdir $copyTo 2> /dev/null
+ test -e "$copyTo" || {
+ gen-template --name "$name" < ~/.gen/$type/$file > "$copyTo"
+ }
done
}
Please sign in to comment.
Something went wrong with that request. Please try again.