Преглед на файлове

- 修改了config.toml的格式: 把单独的key放置在前;
- 修改了Stateful的Toml部分: 针对config的内容支持完毕

NandHyf преди 1 година
родител
ревизия
d83256845e
променени са 2 файла, в които са добавени 20 реда и са изтрити 20 реда
  1. 8 10
      Controller.py
  2. 12 10
      config.toml

+ 8 - 10
Controller.py

@@ -6,21 +6,18 @@ class Command():
     pass
 
 class Client():
-    def __init__(self) -> None:
-        pass
-
 
     def get_config():
-        doc = Stateful.getTomlDoc("config.toml")
-        
         # T-B-C...
-        global lang
-        lang = ""
+        configs = ['lang', 'listStyle']
+        rl = Stateful.matchTomlKeys("config.toml", configs)
+        global lang, listStyle
+        lang = rl[0]
+        listStyle = rl[1]
 
 
     def get_help():
-        t = Stateful.matchTomlKey("config.toml", "lang")
-        print(t)
+        print(Stateful.matchTomlKey("config.toml", lang, "command-help"))
 
 
     def excute():
@@ -31,9 +28,10 @@ class Client():
         # get config
         Client.get_config()
 
-        # test aera
+        # test code
         Client.get_help()
 
+
         # list board
         # Command.list
 

+ 12 - 10
config.toml

@@ -2,26 +2,28 @@
 # zh-s == 简体中文; zh-f == 繁体中文(暫未支持)
 lang = "en"
 
+# tree/expand
+listStyle = "tree"
+
+# >>>need some guidance here<<<
+EnableGlobalCommand = false
+
 # Choose between: sqlite3/toml/md/csv/mongodb
 # However toml/md/csv/mongodb are not supported in v1.0
 [Database]
 type = "sqlite3"
 path = "test.db"
 
-# >>>need some guidance here<<<
-EnableGlobalCommand = false
-
-# tree/expand
-listBoardStyle = "tree"
 
-# ----- help Text -----
-# 应该是用asicⅡ然后根据系统语言转换?
-[commands]
+# ----- helps -----
+# 难道用asicⅡ然后根据系统语言转换?
+[command-help]
 en = """
-
+Help texts in en
 """
-zh-s = """
 
+zh-s = """
+Help texts in zh-s
 """
 
 [could-not-find]