Polish helper script

This commit is contained in:
Zachary Talis 2021-06-27 15:08:08 -04:00
parent ece35b27e6
commit ff7c757ff0
4 changed files with 8 additions and 13 deletions

View file

@ -12,13 +12,8 @@ def generate():
"""Regenerate site"""
runIdName = "tk_run_id"
categoryIdName = "tk_category_dashname"
runs = util_csv.dictReaderMultiRow("../csv/runs.csv", runIdName)
categories = util_csv.dictReaderMultiRow("../csv/categories.csv", categoryIdName)
config = util_csv.dictReaderFirstRow("../csv/config.csv")
print(len(config))
print(len(categories))
print(len(runs))
if len(config) != 0 and len(categories) != 0 and len(runs) != 0:
if len(config) != 0:
subprocess.call(cwd + "/generate.py", shell=True)
@ -39,6 +34,7 @@ def optionAddRun():
def optionQuit():
"""Quit"""
print()
os._exit(1)
@ -54,6 +50,7 @@ options = [optionSetup, optionAddCategory, optionAddRun, optionQuit]
# Main loop
while True:
key = "tk_game_name"
config = util_csv.dictReaderFirstRow("../csv/config.csv")
print(f"\n[ paceboard for {config[key]} ]")
index = 0
for option in options:

View file

@ -21,5 +21,5 @@ categoryDict = {
util_csv.dictWriter("../csv/categories.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"
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)."
)

View file

@ -59,7 +59,7 @@ while not doneCategoryInput:
categoriesNew = {}
for category in categoriesOld:
categoriesNew[index] = categoriesOld[category]
print(f"{index} - {categoriesNew[index][displayName]}")
print(f"{index + 1} - {categoriesNew[index][displayName]}")
index += 1
try:
@ -67,7 +67,7 @@ while not doneCategoryInput:
rawCategoryInput = input("Your pick: ")
except KeyboardInterrupt:
os._exit(1)
categoryInput = int(rawCategoryInput)
categoryInput = int(rawCategoryInput) - 1
if categoryInput <= index:
try:
tk_run_category_dashname = categoriesNew[categoryInput][
@ -102,5 +102,5 @@ runDict = {
util_csv.dictWriter("../csv/runs.csv", runDict, "a")
print(
f"\n{divider}\n\nAdded run! If you made a mistake, you can manually edit csv/runs.csv\n"
f"\n{divider}\n\nAdded run! If you made a mistake, you can manually edit csv/runs.csv"
)

View file

@ -25,6 +25,4 @@ configDict = {
util_csv.dictWriter("../csv/config.csv", configDict)
print(
f"\n{divider}\n\nPerfect! You can always overwrite the info above by running this script again.\nHere's an overview of how to use paceboard:\n\n- Add a category using scripts/add-category.py\n- Add a run using scripts/add-run.py\n- Use scripts/generate.py to update the site with the info you've added.\n- All categories, runs, and configuration details are stored in csv/\n- Replace the logo saved as assets/img/logo.png\n- For the adventurous, you can restyle your site's pages by editing files within templates/ and css/\n\nRemember to run scripts/generate.py to initialize your site.\nThat's all for now! <3\n"
)
print(f"\n{divider}\n\nPerfect, that's all for now! <3")