Skip to content
Snippets Groups Projects
Commit 783cff41 authored by Seblu's avatar Seblu
Browse files

only one profile loaded at a time

parent 0e9de1c9
No related branches found
No related tags found
No related merge requests found
......@@ -17,12 +17,10 @@ Loading
=======
Configuration is loaded in this order:
1 Check CC_DEBUG, to set early debugging mode
2 load [cli] profile in ~/.config/cc-cli/profile
3 load profile specified by option profile in [cli] profile
4 load profile specified by environment
5 load profile specified on command line
6 load options from environment
7 load options from command line
2 load [cli] profile from ~/.config/cc-cli/profile
3 load profile specified by option profile (arg line, env, cli profile)
4 load options from environment
5 load options from command line
===========
Environment
......
......@@ -77,25 +77,16 @@ try:
# load default profile
if fparser.has_section("cli"):
settings.update(fparser.items("cli"))
# load next profile from cli profile
if "profile" in settings:
if fparser.has_section(settings["profile"]):
settings.update(fparser.items(settings["profile"]))
del settings["profile"]
else:
printer.warn("Unable to load profile %s"%settings["profile"])
# load env profile
if "CC_PROFILE" in os.environ:
if fparser.has_section(os.environ["CC_PROFILE"]):
settings.update(fparser.items(os.environ["CC_PROFILE"]))
else:
printer.warn("Unable to load profile %s"%os.environ["CC_PROFILE"])
# load argline profile
# choose next profile to load
if options.profile:
if fparser.has_section(options.profile):
settings.update(fparser.items(options.profile))
else:
printer.warn("Unable to load profile %s"%options.profile)
settings["profile"] = options.profile
elif "CC_PROFILE" in os.environ:
settings["profile"] = os.environ["CC_PROFILE"]
# load next profile
if fparser.has_section(settings["profile"]):
settings.update(fparser.items(settings["profile"]))
else:
printer.warn("Unable to load profile %s"%settings["profile"])
except Exception as e:
if cccli.debug:
raise
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment