~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 :)
This commit is contained in:
34
zshenv
34
zshenv
@@ -20,27 +20,31 @@ spu() { # Use
|
|||||||
}
|
}
|
||||||
|
|
||||||
gentemplate() {
|
gentemplate() {
|
||||||
case $1 in
|
for var in ${@:2}; do
|
||||||
'c') git clone https://github.com/Oreodave/CTemplate $2;;
|
case $1 in
|
||||||
'cpp') git clone https://github.com/Oreodave/CPPTemplate $2;;
|
'c') git clone https://github.com/Oreodave/CTemplate $var;;
|
||||||
'python') git clone https://github.com/Oreodave/PythonTemplate $2;;
|
'cpp') git clone https://github.com/Oreodave/CPPTemplate $var;;
|
||||||
'node') git clone https://github.com/Oreodave/NodeTemplate $2;;
|
'python') git clone https://github.com/Oreodave/PythonTemplate $var;;
|
||||||
'ard') git clone https://github.com/Oreodave/ArduinoTemplate $2;;
|
'node') git clone https://github.com/Oreodave/NodeTemplate $var;;
|
||||||
*) return;;
|
'ard') git clone https://github.com/Oreodave/ArduinoTemplate $var;;
|
||||||
esac
|
*) return;;
|
||||||
rm -rf $2/.git;
|
esac
|
||||||
|
rm -rf $var/.git;
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
gentemplateoff () {
|
gentemplateoff () {
|
||||||
|
for var in ${@:2}; do
|
||||||
case $1 in
|
case $1 in
|
||||||
'c') cp -r ~/Projects/Templates/CTemplate $2;;
|
'c') cp -r ~/Projects/Templates/CTemplate $var;;
|
||||||
'cpp') cp -r ~/Projects/Templates/CPPTemplate $2;;
|
'cpp') cp -r ~/Projects/Templates/CPPTemplate $var;;
|
||||||
'python') cp -r ~/Projects/Templates/PythonTemplate $2;;
|
'python') cp -r ~/Projects/Templates/PythonTemplate $var;;
|
||||||
'node') cp -r ~/Projects/Templates/NodeTemplate $2;;
|
'node') cp -r ~/Projects/Templates/NodeTemplate $var;;
|
||||||
'ard') cp -r ~/Projects/Templates/ArduinoTemplate $2;;
|
'ard') cp -r ~/Projects/Templates/ArduinoTemplate $var;;
|
||||||
*) return;;
|
*) return;;
|
||||||
esac
|
esac
|
||||||
rm -rf $2/.git;
|
rm -rf $var/.git;
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Web Querying
|
# Web Querying
|
||||||
|
|||||||
Reference in New Issue
Block a user