Skip to content

Commit a0c5e6c

Browse files
committed
cli(_output[docs]): Document plan fields
why: Autodoc renders the plan dataclasses field by field, so the undocumented ones ship to the API reference bare. what: - Add Attributes sections to PlanEntry, PlanSummary, PlanRenderOptions, and PlanResult - Spell out what None means for the optional status fields and which sync flags drive each render option
1 parent dab8fa1 commit a0c5e6c

1 file changed

Lines changed: 95 additions & 4 deletions

File tree

src/vcspull/cli/_output.py

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,51 @@ class PlanAction(Enum):
2929

3030
@dataclass
3131
class PlanEntry:
32-
"""Represents a single planned action for a repository."""
32+
"""Represents a single planned action for a repository.
33+
34+
Attributes
35+
----------
36+
name : str
37+
Repository name as keyed in the config file.
38+
path : str
39+
Checkout location on disk. Human and JSON output contract the home
40+
directory to ``~``.
41+
workspace_root : str
42+
Workspace root the repository is grouped under; ``""`` when the config
43+
entry carries none, which human output groups as ``(no workspace)``.
44+
action : PlanAction
45+
Action the plan resolved for this repository.
46+
detail : str | None
47+
Short explanation of the action, such as ``"missing"`` or
48+
``"behind 2"``; ``None`` when no explanation applies.
49+
url : str | None
50+
VCS URL to clone or pull from; ``None`` when the entry carries no URL.
51+
branch : str | None
52+
Branch currently checked out; ``None`` when the checkout is absent or
53+
the branch could not be read.
54+
remote_branch : str | None
55+
Upstream tracking branch, such as ``"origin/main"``; ``None`` when
56+
unknown.
57+
current_rev : str | None
58+
Revision the checkout sits at; ``None`` when unknown.
59+
target_rev : str | None
60+
Revision a sync would move the checkout to; ``None`` when unknown.
61+
ahead : int | None
62+
Commits the local branch holds that the upstream lacks; ``None`` when
63+
the comparison is unavailable, as for a missing or non-git checkout.
64+
behind : int | None
65+
Commits the upstream holds that the local branch lacks; ``None`` when
66+
the comparison is unavailable.
67+
dirty : bool | None
68+
``True`` when the working tree has uncommitted changes; ``None`` when
69+
cleanliness could not be determined.
70+
error : str | None
71+
Message describing why planning failed for this repository; ``None``
72+
when planning succeeded.
73+
diagnostics : list[str]
74+
Extra messages carried into the serialised payload; empty when there
75+
are none, and then omitted from the payload.
76+
"""
3377

3478
name: str
3579
path: str
@@ -102,7 +146,26 @@ def to_payload(self) -> dict[str, t.Any]:
102146

103147
@dataclass
104148
class PlanSummary:
105-
"""Aggregate summary for a synchronization plan."""
149+
"""Aggregate summary for a synchronization plan.
150+
151+
Attributes
152+
----------
153+
clone : int
154+
Repositories with no checkout yet, to be cloned.
155+
update : int
156+
Repositories with upstream work to pull.
157+
unchanged : int
158+
Repositories already up to date.
159+
blocked : int
160+
Repositories held back by local state: a dirty working tree,
161+
local-only commits, or divergence from the upstream.
162+
errors : int
163+
Repositories that could not be planned, such as when refreshing
164+
remotes failed.
165+
duration_ms : int | None
166+
Wall-clock time spent building the plan, in milliseconds; ``None``
167+
when no timing was recorded, and then omitted from the payload.
168+
"""
106169

107170
clone: int = 0
108171
update: int = 0
@@ -151,7 +214,26 @@ def to_payload(self) -> dict[str, t.Any]:
151214

152215
@dataclass
153216
class PlanRenderOptions:
154-
"""Rendering options for human plan output."""
217+
"""Rendering options for human plan output.
218+
219+
Attributes
220+
----------
221+
show_unchanged : bool
222+
Keep repositories whose action is ``UNCHANGED`` in the rendered rows
223+
(``--show-unchanged``); they are dropped otherwise.
224+
summary_only : bool
225+
Print the summary line alone and skip per-repository rows
226+
(``--summary-only``).
227+
long : bool
228+
Show the extended block under each row with URL, ahead/behind counts,
229+
and error text (``--long``).
230+
verbosity : int
231+
Repeated ``-v`` count, clamped to 0-2. At 1 or above, rows gain inline
232+
detail extras; at 2 they gain the extended block.
233+
relative_paths : bool
234+
Render paths relative to the workspace root (``--relative-paths``)
235+
instead of contracting the home directory to ``~``.
236+
"""
155237

156238
show_unchanged: bool = False
157239
summary_only: bool = False
@@ -162,7 +244,16 @@ class PlanRenderOptions:
162244

163245
@dataclass
164246
class PlanResult:
165-
"""Container for plan entries and their summary."""
247+
"""Container for plan entries and their summary.
248+
249+
Attributes
250+
----------
251+
entries : list[PlanEntry]
252+
One entry per repository the plan evaluated, in the order evaluation
253+
finished; rendering sorts them by action and name.
254+
summary : PlanSummary
255+
Action counts tallied across ``entries``.
256+
"""
166257

167258
entries: list[PlanEntry]
168259
summary: PlanSummary

0 commit comments

Comments
 (0)