Coverage for little_loops / cli / issues / sections.py: 0%
20 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-06-26 17:38 -0500
« prev ^ index » next coverage.py v7.12.0, created at 2026-06-26 17:38 -0500
1"""ll-issues sections: Print section template JSON for an issue type."""
3from __future__ import annotations
5import sys
6from typing import TYPE_CHECKING
8if TYPE_CHECKING:
9 import argparse
11 from little_loops.config import BRConfig
13_VALID_TYPES = ("bug", "feat", "enh", "epic")
16def cmd_sections(config: BRConfig, args: argparse.Namespace) -> int:
17 """Print section template JSON (or its path) for an issue type.
19 Args:
20 config: Project configuration
21 args: Parsed arguments with .type (str) and optional .path (bool)
23 Returns:
24 0 on success, 1 on invalid type or missing template
25 """
26 from little_loops.issue_template import resolve_templates_dir
28 issue_type = args.type.lower()
29 if issue_type not in _VALID_TYPES:
30 print(
31 f"Error: invalid type '{args.type}' — must be bug, feat, enh, or epic",
32 file=sys.stderr,
33 )
34 return 1
36 templates_dir = resolve_templates_dir(config)
37 json_path = templates_dir / f"{issue_type}-sections.json"
39 if not json_path.exists():
40 print(f"Error: template not found: {json_path}", file=sys.stderr)
41 return 1
43 if getattr(args, "path", False):
44 print(json_path)
45 return 0
47 print(json_path.read_text())
48 return 0