Coverage for little_loops / cli / issues / next_id.py: 0%

17 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2026-06-26 17:38 -0500

1"""ll-issues next-id: Print the next globally unique issue number.""" 

2 

3from __future__ import annotations 

4 

5import argparse 

6from typing import TYPE_CHECKING 

7 

8if TYPE_CHECKING: 

9 from little_loops.config import BRConfig 

10 

11 

12def positive_int(value: str) -> int: 

13 """Argparse type validator that requires a positive integer.""" 

14 try: 

15 n = int(value) 

16 except ValueError: 

17 raise argparse.ArgumentTypeError(f"{value!r} is not a valid integer") from None 

18 if n < 1: 

19 raise argparse.ArgumentTypeError(f"--count must be a positive integer, got {n}") 

20 return n 

21 

22 

23def cmd_next_id(config: BRConfig, count: int = 1) -> int: 

24 """Print the next globally unique issue number(s). 

25 

26 Args: 

27 config: Project configuration 

28 count: Number of consecutive IDs to emit (default 1) 

29 

30 Returns: 

31 Exit code (0 = success) 

32 """ 

33 from little_loops.issue_parser import get_next_issue_number 

34 

35 base = get_next_issue_number(config) 

36 for i in range(count): 

37 print(f"{base + i:03d}") 

38 return 0