Coverage for little_loops / cli / next_id.py: 100%
14 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-02-15 15:23 -0600
« prev ^ index » next coverage.py v7.12.0, created at 2026-02-15 15:23 -0600
1"""ll-next-id: Print the next globally unique issue number."""
3from __future__ import annotations
5import argparse
6from pathlib import Path
9def main_next_id() -> int:
10 """Entry point for ll-next-id command.
12 Prints the next globally unique issue number by scanning all issue
13 directories (active and completed). Wraps get_next_issue_number().
15 Returns:
16 Exit code (0 = success)
17 """
18 from little_loops.config import BRConfig
19 from little_loops.issue_parser import get_next_issue_number
21 parser = argparse.ArgumentParser(
22 prog="ll-next-id",
23 description="Print the next globally unique issue number",
24 formatter_class=argparse.RawDescriptionHelpFormatter,
25 epilog="""
26Examples:
27 %(prog)s # Print next issue number (e.g., 042)
28 %(prog)s --config /path # Use specific project root
29""",
30 )
32 parser.add_argument(
33 "--config",
34 type=Path,
35 default=None,
36 help="Path to project root (default: current directory)",
37 )
39 args = parser.parse_args()
41 project_root = args.config or Path.cwd()
42 config = BRConfig(project_root)
44 next_num = get_next_issue_number(config)
45 print(f"{next_num:03d}")
47 return 0