123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import kbc_alt
- import kbc_toml
- import kbc_sqlite
- import kbc_llm
- import datetime
- # class config def read(), reload()
- class kbc_controller():
- def get_app_config(returnDict:bool=True):
- tomls = kbc_toml.MatchTomlTable("dev.toml", "app_config", "dict")
- if returnDict == True:
- return tomls
-
- def get_help():
- pass
-
- def rewrite_config():
- pass
- # [todo 4]
- def display_in_timezone(timezone:int=0):
- pass
-
- # [todo 2]
- def validCheck(c_list:list=[]):
- # c_list == 'c'ommand 'list'
- #
- commandType = {"/": 0, "..": 1, "select": 1, "add": 1, "delete": 1, "edit": 1, "move": 1, "to": 1, "in": 1}
- objType = {"board": 3, "class": 2, "event": 1}
- try:
- if ".." in c_list and "/" in c_list:
- kbc_alt.Err(0)
- return 0
- elif c_list[0] == "/":
- print("command is 'back_home' ")
- c_list = [0]
- print(c_list)
- return 0
-
- elif c_list[0] == "..":
- print("command is 'back_previous' ")
- c_list[0] = 1
- print(c_list)
- return 0
-
- # 指令总和 > 某个数说明后面还有不合规的语法
- except IndexError:
- kbc_alt.Err(0)
- def makeLog():
- pass
- def direct():
- sqls = input("direct sqls(ONE SQL STATEMENT ONLY): ")
- res = kbc_sqlite.exec(kbc_sqlite.oc['dp'], sqls, True)
- print("res: ", res)
- # [todo 4]
- def start():
- app_config = kbc_controller.get_app_config()["app_config"]
- kbc_sqlite.oc['dt'] = app_config['DBType']
- kbc_sqlite.oc['dp'] = app_config['DBPath']
- # if start_as_llmserver == True:
-
- kbc_sqlite.oc['cp'] = ['home']
- while(True):
- c_list = input("input command: ").split()
- kbc_controller.validCheck(c_list)
- if __name__ == "__main__":
- kbc_controller.start()
- # kbc_alt.pause()
|