Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.

Commit a5a11a1

Browse files
committed
feat: abstract project.md
1 parent 403a59d commit a5a11a1

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

scratch_cli/cmd/find.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from scratch_cli.context import context
44
from scratch_cli import rfmt
5+
from scratch_cli import safmt
56
import scratchattach as sa
67

78
def find(*,
@@ -16,12 +17,7 @@ def find(*,
1617
match mode:
1718
case "shared" | _:
1819
for project in user.projects(limit=limit, offset=offset):
19-
rfmt.print_fp(
20-
"project.md",
21-
title=project.title,
22-
id=project.id,
23-
author=project.author_name,
24-
)
20+
rfmt.print_md(safmt.project(project))
2521

2622
return
2723

scratch_cli/safmt.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# format sa objects
2+
import scratchattach as sa
3+
from scratch_cli import rfmt
4+
5+
6+
def project(self: sa.Project):
7+
return rfmt.md_fp(
8+
"project.md",
9+
title=self.title,
10+
id=self.id,
11+
author=self.author_name,
12+
)

0 commit comments

Comments
 (0)