summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJosé Mota <jose@josemota.net>2016-06-09 22:40:19 +0100
committerJosé Mota <jose@josemota.net>2016-06-09 22:40:19 +0100
commit4eebaa63f19c075734ae6a04a7c4e5ec4e0f3290 (patch)
tree73d6f41a4517a18d8bea2093bffcc16cc0be0054 /bin
parent11e1db05be252cc47cb6583b06c9208f2500dbf1 (diff)
Improve script.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/thomas25
1 files changed, 20 insertions, 5 deletions
diff --git a/bin/thomas b/bin/thomas
index f3eca1c..3d049eb 100755
--- a/bin/thomas
+++ b/bin/thomas
@@ -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