Skip to content

armgit / fli

Public Imported from GitHub
0

Google Flights MCP, CLI and Python Library

Add --sort param

Punit Araniadc716d46fce
diff --git a/fli/cli/commands/cheap.py b/fli/cli/commands/cheap.py
index 741eff2..0cf7fac 100644
--- a/fli/cli/commands/cheap.py
+++ b/fli/cli/commands/cheap.py
@@ -40,6 +40,13 @@ def cheap(
help="Maximum number of stops (ANY, 0 for non-stop, 1 for one stop, 2+ for two stops)",
),
] = "ANY",
+ sort: Annotated[
+ bool,
+ typer.Option(
+ "--sort",
+ help="Sort results by price (lowest to highest)",
+ ),
+ ] = False,
monday: Annotated[
bool,
typer.Option(
@@ -164,6 +171,10 @@ def cheap(
typer.echo("No flights found for the selected days.")
raise typer.Exit(1)
+ # Sort dates by price if sort flag is enabled
+ if sort:
+ dates.sort(key=lambda x: x.price)
+
# Display results
display_date_results(dates)