Skip to content

Commit 63492ad

Browse files
committed
add about cmd
1 parent 86a8c70 commit 63492ad

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

mytonctrl/mytonctrl.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def inject_globals(func):
7272
console.AddItem("status_modes", inject_globals(mode_status), local.translate("status_modes_cmd"))
7373
console.AddItem("enable_mode", inject_globals(enable_mode), local.translate("enable_mode_cmd"))
7474
console.AddItem("disable_mode", inject_globals(disable_mode), local.translate("disable_mode_cmd"))
75+
console.AddItem("about", inject_globals(about), local.translate("about_cmd"))
7576
console.AddItem("get", inject_globals(GetSettings), local.translate("get_cmd"))
7677
console.AddItem("set", inject_globals(SetSettings), local.translate("set_cmd"))
7778
console.AddItem("rollback", inject_globals(rollback_to_mtc1), local.translate("rollback_cmd"))
@@ -176,6 +177,21 @@ def inject_globals(func):
176177
local.db.config.logLevel = "debug" if console.debug else "info"
177178
local.db.config.isLocaldbSaving = False
178179
local.run()
180+
#end define
181+
182+
183+
def about(local, ton, args):
184+
if len(args) != 1:
185+
color_print("{red}Bad args. Usage:{endc} about <mode_name>")
186+
mode_name = args[0]
187+
mode = ton.get_mode(mode_name)
188+
if mode is None:
189+
color_print(f"{{red}}Mode {mode_name} not found{{endc}}")
190+
return
191+
color_print(f'''{{cyan}}===[ {mode_name} MODE ]==={{cyan}}=''')
192+
color_print(f'''Description: {mode.description}''')
193+
color_print('Enabled: ' + color_text('{green}yes{endc}' if ton.get_mode_value(mode_name) else '{red}no{endc}'))
194+
#end define
179195

180196

181197
def check_installer_user():

mytonctrl/resources/translate.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
"ru": "Показать режимы MTC",
2020
"zh_TW": "顯示 MTC 模式"
2121
},
22+
"about_cmd": {
23+
"en": "Mode description",
24+
"ru": "Описание режима",
25+
"zh_TW": "模式描述"
26+
},
2227
"enable_mode_cmd": {
2328
"en": "Enable mode",
2429
"ru": "Включить режим",

0 commit comments

Comments
 (0)