diff --git a/README b/README index 21444af4d3736d2a2aaf1ca4de52da1c89851146..1ce3648c3ffba0df4b0dd21ae7f4831afa5fffee 100644 --- a/README +++ b/README @@ -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 diff --git a/bin/cc-cli b/bin/cc-cli index 60f2b8d1c5359b7ba0bd74729717709ab3352fa0..14f11f7a5f5a94c51871a23ecdeba645f9a36836 100755 --- a/bin/cc-cli +++ b/bin/cc-cli @@ -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