diff options
author | A. Chavali <aryadevchavali1@gmail.com> | 2019-12-20 20:58:51 +0000 |
---|---|---|
committer | A. Chavali <aryadevchavali1@gmail.com> | 2019-12-20 21:00:03 +0000 |
commit | cad13a767432528a072366dd431519ab4e568ac2 (patch) | |
tree | 149c2d8f13aa3fecf939c6c763abffb6e7f7357a /zshenv | |
parent | dbed0c4f600a4e204028f40cb6eb309cfabbd553 (diff) | |
download | dotfiles-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 :)
Diffstat (limited to 'zshenv')
-rw-r--r-- | zshenv | 34 |
1 files changed, 19 insertions, 15 deletions
@@ -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 |