From 9fb6d7b078bbfd8b81434ae6fdff16bf76d79473 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Mon, 18 Dec 2023 08:22:37 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20=E2=80=94=20Reintroduce=20valida?= =?UTF-8?q?te=5Fmax=5Fresults=20and=20use=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- argos/commands.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/argos/commands.py b/argos/commands.py index 23ae9f1..63b1bd9 100644 --- a/argos/commands.py +++ b/argos/commands.py @@ -92,8 +92,19 @@ def validate_max_lock_seconds(ctx, param, value): return value +def validate_max_results(ctx, param, value): + if value <= 0: + raise click.BadParameter("Should be a positive integer") + return value + + @server.command() -@click.option("--max-results", default=100, help="Number of results per task to keep") +@click.option( + "--max-results", + default=100, + help="Number of results per task to keep", + callback=validate_max_results, +) @click.option( "--max-lock-seconds", default=100,