Add version metadata and --version command

This commit is contained in:
MarkRx
2024-12-09 09:27:27 -07:00
parent 39a461b3b2
commit 75a120952c
4 changed files with 29 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import os
from pr_agent.agent.pr_agent import PRAgent, commands
from pr_agent.config_loader import get_settings
from pr_agent.log import get_logger, setup_logger
from pr_agent.version import get_version
log_level = os.environ.get("LOG_LEVEL", "INFO")
setup_logger(log_level)
@ -45,6 +46,7 @@ def set_parser():
To edit any configuration parameter from 'configuration.toml', just add -config_path=<value>.
For example: 'python cli.py --pr_url=... review --pr_reviewer.extra_instructions="focus on the file: ..."'
""")
parser.add_argument('--version', action='version', version=f'pr-agent {get_version()}')
parser.add_argument('--pr_url', type=str, help='The URL of the PR to review', default=None)
parser.add_argument('--issue_url', type=str, help='The URL of the Issue to review', default=None)
parser.add_argument('command', type=str, help='The', choices=commands, default='review')