This commit is contained in:
Zachary Talis 2021-06-25 14:06:50 -04:00 committed by GitHub
parent 6e8ef93e23
commit 15e8e60f3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

35
a
View file

@ -1,35 +0,0 @@
diff --git a/scripts/add-run.py b/scripts/add-run.py
index e69de29..c2ab3a8 100644
--- a/scripts/add-run.py
+++ b/scripts/add-run.py
@@ -0,0 +1,30 @@
+### Script for adding a new category. Handles adding data to config.csv.
+
+from utils import csv as util_csv
+
+divider = "----------"
+
+print(
+ f"\nWe'll ask for the name, description, and rules of the new category.\n\n{divider}\n"
+)
+
+# tk_category_name, tk_category_dashname, tk_category_description, tk_category_rules
+
+tk_category_name = input("Name: ")
+tk_category_description = input("Description: ")
+tk_category_rules = input("Rules: ")
+
+tk_category_dashname = tk_category_name.replace(" ", "_")
+
+categoryDict = {
+ "tk_category_name": tk_category_name,
+ "tk_category_dashname": tk_category_dashname,
+ "tk_category_description": tk_category_description,
+ "tk_category_rules": tk_category_rules,
+}
+
+util_csv.dictWriter("../csv/config.csv", categoryDict, "a")
+
+print(
+ f"\n{divider}\n\nAdded category! If you made a mistake, you can manually edit csv/categories.csv (and csv/runs.csv if you've added any runs to the borked category). \n"
+)