refactor: move format_settings function to separate file

This commit is contained in:
Paul Gauthier (aider) 2024-08-29 06:30:37 -07:00
parent de56792f90
commit 43d3cf2c71
2 changed files with 18 additions and 16 deletions

View file

@ -0,0 +1,17 @@
from aider.utils import scrub_sensitive_info
def format_settings(parser, args):
show = scrub_sensitive_info(args, parser.format_values())
# clean up the headings for consistency w/ new lines
heading_env = "Environment Variables:"
heading_defaults = "Defaults:"
if heading_env in show:
show = show.replace(heading_env, "\n" + heading_env)
show = show.replace(heading_defaults, "\n" + heading_defaults)
show += "\n"
show += "Option settings:\n"
for arg, val in sorted(vars(args).items()):
if val:
val = scrub_sensitive_info(args, str(val))
show += f" - {arg}: {val}\n" # noqa: E221
return show