Start helper script implementation
This commit is contained in:
parent
3ef481405b
commit
70d3d14b59
2 changed files with 54 additions and 1 deletions
53
paceboard.py
53
paceboard.py
|
@ -1,3 +1,56 @@
|
|||
#!/usr/bin/env python3
|
||||
### Main helper script.
|
||||
|
||||
import subprocess, os
|
||||
import scripts.utils.csv as util_csv
|
||||
|
||||
# If no setup completed, run setup script
|
||||
config = util_csv.dictReaderFirstRow("csv/config.csv")
|
||||
if config == {}:
|
||||
subprocess.call("scripts/setup.py", shell=True)
|
||||
|
||||
doneOptionInput = False
|
||||
|
||||
|
||||
def optionSetup():
|
||||
"""Reconfigure site details"""
|
||||
print("hi")
|
||||
|
||||
|
||||
def optionAddCategory():
|
||||
"""Add category"""
|
||||
print("hello")
|
||||
|
||||
|
||||
def optionAddRun():
|
||||
"""Add run"""
|
||||
print("cool")
|
||||
|
||||
|
||||
def optionQuit():
|
||||
"""Quit"""
|
||||
os._exit(1)
|
||||
|
||||
|
||||
options = [optionSetup, optionAddCategory, optionAddRun, optionQuit]
|
||||
|
||||
while True:
|
||||
key = "tk_game_name"
|
||||
print(f"\n[ paceboard for {config[key]} ]")
|
||||
index = 0
|
||||
for option in options:
|
||||
print(f"{index + 1} - {options[index].__doc__}")
|
||||
index += 1
|
||||
try:
|
||||
try:
|
||||
rawOptionInput = input("Your pick: ")
|
||||
except KeyboardInterrupt:
|
||||
os._exit(1)
|
||||
optionInput = int(rawOptionInput)
|
||||
if 0 < optionInput <= len(options):
|
||||
print("")
|
||||
options[optionInput - 1]()
|
||||
else:
|
||||
print("Not a valid choice!")
|
||||
except:
|
||||
print("Not a valid choice!")
|
||||
|
|
|
@ -79,7 +79,7 @@ while not doneCategoryInput:
|
|||
else:
|
||||
print("Not a valid choice!")
|
||||
except:
|
||||
print("Not a number!")
|
||||
print("Not a valid choice!")
|
||||
print(f"You picked - {categoriesNew[categoryInput][displayName]}\n")
|
||||
|
||||
## End of: Handle input of tk_run_category_dashname ##
|
||||
|
|
Loading…
Reference in a new issue