aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Chavali <aryadevchavali1@gmail.com>2019-12-20 20:58:51 +0000
committerA. Chavali <aryadevchavali1@gmail.com>2019-12-20 21:00:03 +0000
commitcad13a767432528a072366dd431519ab4e568ac2 (patch)
tree149c2d8f13aa3fecf939c6c763abffb6e7f7357a
parentdbed0c4f600a4e204028f40cb6eb309cfabbd553 (diff)
downloaddotfiles-cad13a767432528a072366dd431519ab4e568ac2.tar.gz
dotfiles-cad13a767432528a072366dd431519ab4e568ac2.tar.bz2
dotfiles-cad13a767432528a072366dd431519ab4e568ac2.zip
~gentemplate capable of handling variadic args
By iterating over all arguments from index 1 .. the end of the list, we can get multiple projects generate at once. gentemplateoff also gets this benefit :)
-rw-r--r--zshenv34
1 files changed, 19 insertions, 15 deletions
diff --git a/zshenv b/zshenv
index ffdc041..c4c7b0f 100644
--- a/zshenv
+++ b/zshenv
@@ -20,27 +20,31 @@ spu() { # Use
}
gentemplate() {
- case $1 in
- 'c') git clone https://github.com/Oreodave/CTemplate $2;;
- 'cpp') git clone https://github.com/Oreodave/CPPTemplate $2;;
- 'python') git clone https://github.com/Oreodave/PythonTemplate $2;;
- 'node') git clone https://github.com/Oreodave/NodeTemplate $2;;
- 'ard') git clone https://github.com/Oreodave/ArduinoTemplate $2;;
- *) return;;
- esac
- rm -rf $2/.git;
+ for var in ${@:2}; do
+ case $1 in
+ 'c') git clone https://github.com/Oreodave/CTemplate $var;;
+ 'cpp') git clone https://github.com/Oreodave/CPPTemplate $var;;
+ 'python') git clone https://github.com/Oreodave/PythonTemplate $var;;
+ 'node') git clone https://github.com/Oreodave/NodeTemplate $var;;
+ 'ard') git clone https://github.com/Oreodave/ArduinoTemplate $var;;
+ *) return;;
+ esac
+ rm -rf $var/.git;
+ done
}
gentemplateoff () {
+ for var in ${@:2}; do
case $1 in
- 'c') cp -r ~/Projects/Templates/CTemplate $2;;
- 'cpp') cp -r ~/Projects/Templates/CPPTemplate $2;;
- 'python') cp -r ~/Projects/Templates/PythonTemplate $2;;
- 'node') cp -r ~/Projects/Templates/NodeTemplate $2;;
- 'ard') cp -r ~/Projects/Templates/ArduinoTemplate $2;;
+ 'c') cp -r ~/Projects/Templates/CTemplate $var;;
+ 'cpp') cp -r ~/Projects/Templates/CPPTemplate $var;;
+ 'python') cp -r ~/Projects/Templates/PythonTemplate $var;;
+ 'node') cp -r ~/Projects/Templates/NodeTemplate $var;;
+ 'ard') cp -r ~/Projects/Templates/ArduinoTemplate $var;;
*) return;;
esac
- rm -rf $2/.git;
+ rm -rf $var/.git;
+ done
}
# Web Querying