Commit 783cff41 authored by Seblu's avatar Seblu
Browse files

only one profile loaded at a time

parent 0e9de1c9
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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
+9 −18
Original line number Diff line number Diff line
@@ -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:
        # choose next profile to load
        if 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"]))
                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
        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)
    except Exception as e:
        if cccli.debug:
            raise