diff options
author | José Mota <jose@josemota.net> | 2016-06-09 22:40:19 +0100 |
---|---|---|
committer | José Mota <jose@josemota.net> | 2016-06-09 22:40:19 +0100 |
commit | 4eebaa63f19c075734ae6a04a7c4e5ec4e0f3290 (patch) | |
tree | 73d6f41a4517a18d8bea2093bffcc16cc0be0054 /bin | |
parent | 11e1db05be252cc47cb6583b06c9208f2500dbf1 (diff) |
Improve script.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/thomas | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -1,13 +1,28 @@ #!/bin/bash +install_mo() { + local confirm + if ! command -v "bin/mo" 2>&1 > /dev/null; then + read -p "You don't have mo installed. Install? (Y/n) " -n 1 -r confirm + case $confirm in + [yY]) + curl https://raw.githubusercontent.com/tests-always-included/mo/master/mo > bin/mo + chmod +x bin/mo + ;; + *) + exit 1 + ;; + esac + fi +} + FILE=$1 OUTPUT_FOLDER=output mkdir -p $OUTPUT_FOLDER -if ! command -v "mo" 2> /dev/null; then - echo "You don't have mo installed. Exiting." - exit 2 -fi +install_mo + +source thomas.env && cat templates/$1 | bin/mo > $OUTPUT_FOLDER/$FILE -source thomas.env && cat templates/$1 | mo > $OUTPUT_FOLDER/$FILE +echo $OUTPUT_FOLDER/$FILE |