Google Flights MCP, CLI and Python Library
Update the CLI option "--type ROUND" to "--round / -R"
Punit Arani513b78c6f41f
diff --git a/fli/cli/commands/cheap.py b/fli/cli/commands/cheap.pyindex 9fac396..fbd2b95 100644--- a/fli/cli/commands/cheap.py+++ b/fli/cli/commands/cheap.py@@ -9,7 +9,6 @@ from fli.cli.utils import (filter_dates_by_days,parse_airlines,parse_stops,- parse_trip_type,validate_date,validate_time_range,)@@ -50,14 +49,14 @@ def cheap(help="List of airline codes (e.g., BA KL)",),] = None,- trip_type: Annotated[- str,+ round_trip: Annotated[+ bool,typer.Option(- "--type",- "-t",- help="Trip type (ONEWAY, ROUND)",+ "--round",+ "-R",+ help="Search for round-trip flights",),- ] = "ONEWAY",+ ] = False,stops: Annotated[str,typer.Option(@@ -157,7 +156,7 @@ def cheap(# Parse parametersdeparture_airport = getattr(Airport, from_airport.upper())arrival_airport = getattr(Airport, to_airport.upper())- trip_type = parse_trip_type(trip_type)+ trip_type = TripType.ROUND_TRIP if round_trip else TripType.ONE_WAYmax_stops = parse_stops(stops)seat_type = getattr(SeatType, seat.upper())airlines = parse_airlines(airlines)diff --git a/tests/cli/test_cheap.py b/tests/cli/test_cheap.pyindex 731e7b7..960c7c5 100644--- a/tests/cli/test_cheap.py+++ b/tests/cli/test_cheap.py@@ -4,6 +4,7 @@ import pytestfrom typer.testing import CliRunnerfrom fli.cli.main import app+from fli.models.google_flights.base import TripTypefrom fli.search import DatePrice@@ -14,7 +15,7 @@ def runner():def test_basic_cheap_search(runner, mock_search_dates, mock_console):- """Test basic cheap flight search."""+ """Test basic cheap flight search (one-way by default)."""mock_search_dates.search.return_value = [DatePrice(date=(datetime.now() + timedelta(days=1),),@@ -24,6 +25,8 @@ def test_basic_cheap_search(runner, mock_search_dates, mock_console):result = runner.invoke(app, ["cheap", "JFK", "LAX"])assert result.exit_code == 0mock_search_dates.search.assert_called_once()+ args, _ = mock_search_dates.search.call_args+ assert args[0].trip_type == TripType.ONE_WAYdef test_cheap_with_date_range(runner, mock_search_dates, mock_console):@@ -171,3 +174,46 @@ def test_cheap_no_results(runner, mock_search_dates, mock_console):result = runner.invoke(app, ["cheap", "JFK", "LAX"])assert result.exit_code == 1assert "No flights found" in result.stdout+++def test_cheap_round_trip(runner, mock_search_dates, mock_console):+ """Test cheap search with round-trip flag."""+ mock_search_dates.search.return_value = [+ DatePrice(+ date=(+ datetime.now() + timedelta(days=1),+ datetime.now() + timedelta(days=8),+ ),+ price=599.98,+ ),+ ]+ result = runner.invoke(+ app,+ ["cheap", "JFK", "LAX", "--round"],+ )+ assert result.exit_code == 0+ mock_search_dates.search.assert_called_once()+ args, _ = mock_search_dates.search.call_args+ assert args[0].trip_type == TripType.ROUND_TRIP+++def test_cheap_round_trip_with_duration(runner, mock_search_dates, mock_console):+ """Test cheap round-trip search with custom duration."""+ mock_search_dates.search.return_value = [+ DatePrice(+ date=(+ datetime.now() + timedelta(days=1),+ datetime.now() + timedelta(days=15),+ ),+ price=599.98,+ ),+ ]+ result = runner.invoke(+ app,+ ["cheap", "JFK", "LAX", "--round", "-d", "14"],+ )+ assert result.exit_code == 0+ mock_search_dates.search.assert_called_once()+ args, _ = mock_search_dates.search.call_args+ assert args[0].trip_type == TripType.ROUND_TRIP+ assert args[0].duration == 14