mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 02:34:59 +00:00
refactor: move format_settings function to separate file
This commit is contained in:
parent
de56792f90
commit
43d3cf2c71
2 changed files with 18 additions and 16 deletions
|
@ -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
|
|
@ -10,6 +10,7 @@ from dotenv import load_dotenv
|
||||||
from prompt_toolkit.enums import EditingMode
|
from prompt_toolkit.enums import EditingMode
|
||||||
|
|
||||||
from aider import __version__, models, utils
|
from aider import __version__, models, utils
|
||||||
|
from aider.format_settings import format_settings
|
||||||
from aider.args import get_parser
|
from aider.args import get_parser
|
||||||
from aider.coders import Coder
|
from aider.coders import Coder
|
||||||
from aider.commands import Commands, SwitchCoder
|
from aider.commands import Commands, SwitchCoder
|
||||||
|
@ -132,22 +133,6 @@ def check_gitignore(git_root, io, ask=True):
|
||||||
io.tool_output(f"Added {pat} to .gitignore")
|
io.tool_output(f"Added {pat} to .gitignore")
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
def scrub_sensitive_info(args, text):
|
def scrub_sensitive_info(args, text):
|
||||||
# Replace sensitive information with last 4 characters
|
# Replace sensitive information with last 4 characters
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue