Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes #346

Open
wants to merge 2 commits into
base: v4-dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion resources/modules/builder_cli.py
Original file line number Diff line number Diff line change
@@ -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='<yourFile>', 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:
Expand Down Expand Up @@ -94,4 +131,4 @@ def error(self, type, help):



CLI_Builder()
CLI_Builder()