22from pathlib import Path
33from types import SimpleNamespace as sn
44
5- from . import data
5+ from . import data , log
66
77controls = sn (
88 json_dir = sn (
2828 help = sn (
2929 args = ['-h' , '--help' ],
3030 action = 'help' , help = 'Show help screen'
31+ ),
32+ debug = sn (
33+ args = ['--debug' ],
34+ action = 'store_true' , help = 'Show debug logs'
3135 )
3236)
3337
@@ -49,6 +53,7 @@ def load(cli, caller_file):
4953 cli .config = data .sns .from_dict (data .json .read (cli .config_filepath ))
5054 cli .config_filename = filename
5155 break
56+ log .debug (f'Config file loaded!\n { log .colors .gry } { cli .config } ' if cli .config_filepath else 'No config file found.' )
5257
5358 # Parse CLI args
5459 argp = argparse .ArgumentParser (description = cli .description , add_help = False )
@@ -65,6 +70,7 @@ def load(cli, caller_file):
6570 for key , val in vars (parsed_args ).items (): # apply parsed_args to cli.config
6671 if not getattr (cli .config , key , '' ):
6772 setattr (cli .config , key , val )
73+ log .debug (f'Args parsed!\n { log .colors .gry } { cli .config } ' )
6874
6975 # Init all cli.config vals
7076 for name , ctrl in vars (controls ).items ():
@@ -74,3 +80,4 @@ def load(cli, caller_file):
7480 if val is None and hasattr (ctrl , 'default_val' ):
7581 val = ctrl .default_val
7682 setattr (cli .config , name , val )
83+ log .debug (f'All cli.config vals set!\n { log .colors .gry } { cli .config } ' )
0 commit comments