diff --git a/resources/modules/builder_cli.py b/resources/modules/builder_cli.py index 53b126bd..ed2679bb 100644 --- a/resources/modules/builder_cli.py +++ b/resources/modules/builder_cli.py @@ -1,5 +1,42 @@ import json import os +import argparse +import configparser +parser = argparse.ArgumentParser(description='PySilon CLI') +parser.add_argument('--load', action='store_true', help='Load config') +parser.add_argument('-file', metavar='', help='Specify file') + +args = parser.parse_args() +print('meow') +def load_config(file_path=config_path): + config = configparser.ConfigParser() + + if os.path.exists(file_path): + config.read(file_path) + else: + print(f"Error: File '{file_path}' does not exist.") + sys.exit(1) + + return config + +def save_config(config, file_path=config_path): + with open(file_path, 'w') as config_file: + config.write(config_file) + +def modify_config(config, section, option, value): + if not config.has_section(section): + config.add_section(section) + config.set(section, option, value) + +def find_section_option(config, arg): + for section in config.sections(): + for option in config.options(section): + if arg.lower() == f'-{option.lower()}': + return section, option + return None, None + +if args.config: + config_path = args.config print(os.getcwd()) class CLI_Builder: @@ -94,4 +131,4 @@ def error(self, type, help): -CLI_Builder() \ No newline at end of file +CLI_Builder()