@@ -70,8 +70,10 @@ def inject_globals(func):
7070 console .AddItem ("installer" , inject_globals (Installer ), local .translate ("installer_cmd" ))
7171 console .AddItem ("status" , inject_globals (PrintStatus ), local .translate ("status_cmd" ))
7272 console .AddItem ("status_modes" , inject_globals (mode_status ), local .translate ("status_modes_cmd" ))
73+ console .AddItem ("status_settings" , inject_globals (settings_status ), local .translate ("settings_status_cmd" ))
7374 console .AddItem ("enable_mode" , inject_globals (enable_mode ), local .translate ("enable_mode_cmd" ))
7475 console .AddItem ("disable_mode" , inject_globals (disable_mode ), local .translate ("disable_mode_cmd" ))
76+ console .AddItem ("about" , inject_globals (about ), local .translate ("about_cmd" ))
7577 console .AddItem ("get" , inject_globals (GetSettings ), local .translate ("get_cmd" ))
7678 console .AddItem ("set" , inject_globals (SetSettings ), local .translate ("set_cmd" ))
7779 console .AddItem ("rollback" , inject_globals (rollback_to_mtc1 ), local .translate ("rollback_cmd" ))
@@ -184,6 +186,7 @@ def inject_globals(func):
184186#end define
185187
186188
189+
187190def activate_ton_storage_provider (local , ton , args ):
188191 wallet_name = "provider_wallet_001"
189192 wallet = ton .GetLocalWallet (wallet_name )
@@ -201,6 +204,25 @@ def activate_ton_storage_provider(local, ton, args):
201204#end define
202205
203206
207+ def about (local , ton , args ):
208+ from modules import get_mode , get_mode_settings
209+ if len (args ) != 1 :
210+ color_print ("{red}Bad args. Usage:{endc} about <mode_name>" )
211+ mode_name = args [0 ]
212+ mode = get_mode (mode_name )
213+ if mode is None :
214+ color_print (f"{{red}}Mode { mode_name } not found{{endc}}" )
215+ return
216+ mode_settings = get_mode_settings (mode_name )
217+ color_print (f'''{{cyan}}===[ { mode_name } MODE ]==={{endc}}''' )
218+ color_print (f'''Description: { mode .description } ''' )
219+ color_print ('Enabled: ' + color_text ('{green}yes{endc}' if ton .get_mode_value (mode_name ) else '{red}no{endc}' ))
220+ print ('Settings:' , 'no' if len (mode_settings ) == 0 else '' )
221+ for setting_name , setting in mode_settings .items ():
222+ color_print (f' {{bold}}{ setting_name } {{endc}}: { setting .description } .\n Default value: { setting .default_value } ' )
223+ #end define
224+
225+
204226def check_installer_user ():
205227 args = ["whoami" ]
206228 process = subprocess .run (args , stdin = subprocess .PIPE , stdout = subprocess .PIPE , stderr = subprocess .PIPE , timeout = 3 )
@@ -447,13 +469,28 @@ def sl(ton, args):
447469 Slashing (ton .local , ton )
448470#end define
449471
472+
450473def mode_status (ton , args ):
474+ from modules import get_mode
451475 modes = ton .get_modes ()
452- text = "########## {bold}Modes{endc} ########## \n "
453- for mode in modes :
454- status = '{green}enabled{endc}' if modes [mode ] else '{red}disabled{endc}'
455- text += f"{ mode } : { status } \n "
456- color_print (text )
476+ table = [["Name" , "Status" , "Description" ]]
477+ for mode_name in modes :
478+ mode = get_mode (mode_name )
479+ status = color_text ('{green}enabled{endc}' if modes [mode_name ] else '{red}disabled{endc}' )
480+ table .append ([mode_name , status , mode .description ])
481+ print_table (table )
482+ #end define
483+
484+
485+ def settings_status (ton , args ):
486+ from modules import SETTINGS
487+ table = [["Name" , "Description" , "Mode" , "Default value" , "Current value" ]]
488+ for name , setting in SETTINGS .items ():
489+ current_value = ton .local .db .get (name )
490+ table .append ([name , setting .description , setting .mode , setting .default_value , current_value ])
491+ print_table (table )
492+ #end define
493+
457494
458495def PrintStatus (local , ton , args ):
459496 opt = None
@@ -1289,6 +1326,19 @@ def SetSettings(ton, args):
12891326 color_print (f"{{red}} Error: set { name } ... is deprecated and does not work {{endc}}."
12901327 f"\n Instead, use {{bold}}enable_mode { mode_name } {{endc}}" )
12911328 return
1329+ force = False
1330+ if len (args ) > 2 :
1331+ if args [2 ] == "--force" :
1332+ force = True
1333+ from modules import get_setting
1334+ setting = get_setting (name )
1335+ if setting is None and not force :
1336+ color_print (f"{{red}} Error: setting { name } not found.{{endc}} Use flag --force to set it anyway" )
1337+ return
1338+ if setting is not None and setting .mode is not None :
1339+ if not ton .get_mode_value (setting .mode ) and not force :
1340+ color_print (f"{{red}} Error: mode { setting .mode } is disabled.{{endc}} Use flag --force to set it anyway" )
1341+ return
12921342 ton .SetSettings (name , value )
12931343 color_print ("SetSettings - {green}OK{endc}" )
12941344#end define
0 commit comments