]> rtime.felk.cvut.cz Git - hubacji1/coffee-getter.git/blobdiff - run/drunk_sum.py
Add Club-mate shortcut to drunk sum runnable
[hubacji1/coffee-getter.git] / run / drunk_sum.py
index 004d98e8537d646769aff8b247684fab1e64e562..eeec196ecd112adfe8a12dde886908cc29805eea 100755 (executable)
@@ -4,19 +4,39 @@
 from sys import argv, exit
 from cbgetter import CoffeebotGetter
 
+SS = {
+    "covfefe": "espresso;espresso lungo;cappuccino;latte macchiato",
+    "coffee": "espresso;espresso lungo;cappuccino;latte macchiato",
+    "mate": "Club-Mate 0,5 l;Club-Mate 0,33 l",
+}
+
 if __name__ == "__main__":
     if len(argv) != 4:
-        print("Usage: python3 drunk_sum.py {} {} {}".format(
+        print("Usage: PYTHONPATH=. python3 run/drunk_sum.py {} {} {}".format(
             "\"espresso lungo\"",
             "\"2010-10-20\"",
             "\"2020-10-20\""
         ))
-        print("Or: python3 drunk_sum.py {} {} {}".format(
+        print("Or: PYTHONPATH=. python3 run/drunk_sum.py {} {} {}".format(
             "\"espresso lungo;espresso\"",
             "\"2010-10-20\"",
             "\"2020-10-20\""
         ))
+        print("Or: PYTHONPATH=. python3 run/drunk_sum.py {} {} {}".format(
+            "coffee",
+            "2010-10-20",
+            "2020-10-20"
+        ))
+        print("Instead of beverage real name, you may use:")
+        print("- coffee (for all coffees)")
+        print("- covfefe (equal to coffee)")
+        print("- mate (for all Club-mates)")
         exit(1)
     g = CoffeebotGetter()
-    g.loadDrunkSum(argv[1], argv[2], argv[3])
+    if ";" in argv[1]:
+        g.loadDrunkList(argv[1], argv[2], argv[3])
+    elif argv[1] in SS:
+        g.loadDrunkSum(SS[argv[1]], argv[2], argv[3])
+    else:
+        g.loadDrunkSum(argv[1], argv[2], argv[3])
     print(g.getMsg())