mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-05 04:05:04 +00:00
refactor: Move --set-env processing after IO initialization
This commit is contained in:
parent
af3d8dd6a7
commit
054e0820b7
1 changed files with 11 additions and 11 deletions
|
@ -461,17 +461,6 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
analytics = Analytics(permanently_disable=True)
|
analytics = Analytics(permanently_disable=True)
|
||||||
print("Analytics have been permanently disabled.")
|
print("Analytics have been permanently disabled.")
|
||||||
|
|
||||||
# Process any environment variables set via --set-env
|
|
||||||
if args.set_env:
|
|
||||||
for env_setting in args.set_env:
|
|
||||||
try:
|
|
||||||
name, value = env_setting.split("=", 1)
|
|
||||||
os.environ[name.strip()] = value.strip()
|
|
||||||
except ValueError:
|
|
||||||
io.tool_error(f"Invalid --set-env format: {env_setting}")
|
|
||||||
io.tool_output("Format should be: ENV_VAR_NAME=value")
|
|
||||||
return 1
|
|
||||||
|
|
||||||
if not args.verify_ssl:
|
if not args.verify_ssl:
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
@ -537,6 +526,17 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
io = get_io(False)
|
io = get_io(False)
|
||||||
io.tool_warning("Terminal does not support pretty output (UnicodeDecodeError)")
|
io.tool_warning("Terminal does not support pretty output (UnicodeDecodeError)")
|
||||||
|
|
||||||
|
# Process any environment variables set via --set-env
|
||||||
|
if args.set_env:
|
||||||
|
for env_setting in args.set_env:
|
||||||
|
try:
|
||||||
|
name, value = env_setting.split("=", 1)
|
||||||
|
os.environ[name.strip()] = value.strip()
|
||||||
|
except ValueError:
|
||||||
|
io.tool_error(f"Invalid --set-env format: {env_setting}")
|
||||||
|
io.tool_output("Format should be: ENV_VAR_NAME=value")
|
||||||
|
return 1
|
||||||
|
|
||||||
analytics = Analytics(logfile=args.analytics_log, permanently_disable=args.analytics_disable)
|
analytics = Analytics(logfile=args.analytics_log, permanently_disable=args.analytics_disable)
|
||||||
if args.analytics is not False:
|
if args.analytics is not False:
|
||||||
if analytics.need_to_ask(args.analytics):
|
if analytics.need_to_ask(args.analytics):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue