Skip to content

Commit

Permalink
fix: reuse config parser for cli (#4187)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyaoww authored Oct 3, 2024
1 parent 9c95d0f commit 16a2cf3
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions openhands/core/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import argparse
import asyncio
import logging
from typing import Type
Expand All @@ -10,6 +9,7 @@
from openhands.controller import AgentController
from openhands.controller.agent import Agent
from openhands.core.config import (
get_parser,
load_app_config,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -63,10 +63,10 @@ def display_event(event: Event):
display_command_output(event.content)


def get_parser() -> argparse.ArgumentParser:
"""Get the parser for the command line arguments."""
parser = argparse.ArgumentParser(description='Run an agent with a specific task')
async def main():
"""Runs the agent in CLI mode"""

parser = get_parser()
# Add the version argument
parser.add_argument(
'-v',
Expand All @@ -76,14 +76,6 @@ def get_parser() -> argparse.ArgumentParser:
help='Show the version number and exit',
default=None,
)

return parser


async def main():
"""Runs the agent in CLI mode"""

parser = get_parser()
args = parser.parse_args()

if args.version:
Expand Down

0 comments on commit 16a2cf3

Please sign in to comment.