Skip to content

Commit 98ed0e2

Browse files
authored
refactor(taosctl): dashboard uses shared positive_int validator (#1403)
Replace the dashboard group's inline _positive_int with the shared tinyagentos/cli/taosctl/argtypes.positive_int (landed in #1401), removing the duplicate now that both are on dev. Behaviour unchanged; --limit still rejects non-positive values at parse time.
1 parent a349e54 commit 98ed0e2

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

tinyagentos/cli/taosctl/commands/dashboard.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,11 @@
1010
"""
1111
from __future__ import annotations
1212

13-
import argparse
1413
from urllib.parse import quote
1514

16-
NOUN = "dashboard"
17-
15+
from tinyagentos.cli.taosctl.argtypes import positive_int
1816

19-
def _positive_int(value: str) -> int:
20-
iv = int(value)
21-
if iv <= 0:
22-
raise argparse.ArgumentTypeError("must be a positive integer")
23-
return iv
17+
NOUN = "dashboard"
2418

2519

2620
def register(subparsers) -> None:
@@ -47,7 +41,7 @@ def register(subparsers) -> None:
4741
bp.set_defaults(func=_backends)
4842

4943
ap = verbs.add_parser("activity", help="Recent dashboard activity")
50-
ap.add_argument("--limit", type=_positive_int, default=15)
44+
ap.add_argument("--limit", type=positive_int, default=15)
5145
ap.set_defaults(func=_activity)
5246

5347
mp = verbs.add_parser("metrics", help="Query a named time-series metric")

0 commit comments

Comments
 (0)