mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 02:34:59 +00:00
add sample aider.conf.yml
This commit is contained in:
parent
caca261587
commit
2d62e3fb1f
5 changed files with 523 additions and 2 deletions
|
@ -7,7 +7,7 @@ import sys
|
|||
import configargparse
|
||||
|
||||
from aider import __version__, models
|
||||
from aider.args_formatter import MarkdownHelpFormatter
|
||||
from aider.args_formatter import MarkdownHelpFormatter, YamlHelpFormatter
|
||||
|
||||
from .dump import dump # noqa: F401
|
||||
|
||||
|
@ -468,6 +468,20 @@ def get_help():
|
|||
return parser.format_help()
|
||||
|
||||
|
||||
def get_sample_yaml():
|
||||
os.environ["COLUMNS"] = "100"
|
||||
sys.argv = ["aider"]
|
||||
parser = get_parser([], None)
|
||||
|
||||
# This instantiates all the action.env_var values
|
||||
parser.parse_known_args()
|
||||
|
||||
parser.formatter_class = YamlHelpFormatter
|
||||
|
||||
return argparse.ArgumentParser.format_help(parser)
|
||||
return parser.format_help()
|
||||
|
||||
|
||||
def main():
|
||||
print(get_help())
|
||||
|
||||
|
|
|
@ -3,6 +3,53 @@ import argparse
|
|||
from .dump import dump # noqa: F401
|
||||
|
||||
|
||||
class YamlHelpFormatter(argparse.HelpFormatter):
|
||||
def start_section(self, heading):
|
||||
res = "\n\n"
|
||||
res += "#" * (len(heading) + 2)
|
||||
res += f"\n# {heading}"
|
||||
super().start_section(res)
|
||||
|
||||
def _format_usage(self, usage, actions, groups, prefix):
|
||||
return ""
|
||||
|
||||
def _format_text(self, text):
|
||||
return """
|
||||
##########################################################
|
||||
# Sample .aider.conf.yaml
|
||||
# Place in your home dir, or at the root of your git repo.
|
||||
##########################################################
|
||||
|
||||
"""
|
||||
|
||||
def _format_action(self, action):
|
||||
parts = [""]
|
||||
|
||||
metavar = action.metavar
|
||||
if not metavar and isinstance(action, argparse._StoreAction):
|
||||
metavar = "VALUE"
|
||||
|
||||
if action.default not in (argparse.SUPPRESS, None):
|
||||
default = action.default
|
||||
else:
|
||||
default = False
|
||||
|
||||
default = "true" if default else "false"
|
||||
|
||||
if action.help:
|
||||
parts.append(f"# {action.help}")
|
||||
|
||||
parts.append(f"# {action.dest}: {default}\n")
|
||||
|
||||
return "\n".join(parts) + "\n"
|
||||
|
||||
def _format_action_invocation(self, action):
|
||||
return ""
|
||||
|
||||
def _format_args(self, action, default_metavar):
|
||||
return ""
|
||||
|
||||
|
||||
class MarkdownHelpFormatter(argparse.HelpFormatter):
|
||||
def start_section(self, heading):
|
||||
super().start_section(f"## {heading}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue