mirror of
https://git.srhtnin.garden/sarah/SaraSuite.git
synced 2026-10-13 18:18:12 +02:00
Add SaraSort, listed under SaraSortd
Manifests can name a Parent program; it's listed (indented) right under it, in the window and in `list`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
08c9071b48
commit
6e4c571e38
7 files changed
+62
-2
No files matched your search
+13
-1
@@ -102,6 +102,7 @@ class Program:
|
||||
Name: str
|
||||
Description: str
|
||||
Folder: Path # the manifest's own folder
|
||||
Parent: str = "" # a program this one belongs to (e.g. SaraSort -> SaraSortd): listed indented under it
|
||||
Git: str = "" # e.g. "{GitHost}/SaraSortd"
|
||||
Branch: str = "" # empty = the repo's default branch
|
||||
Include: list[str] = field(default_factory=lambda: ["**"])
|
||||
@@ -192,6 +193,7 @@ def LoadProgram(Folder: Path) -> Program:
|
||||
Name=Data["Name"],
|
||||
Description=Data.get("Description", ""),
|
||||
Folder=Folder,
|
||||
Parent=Data.get("Parent", ""),
|
||||
Git=Source["Git"],
|
||||
Branch=Source.get("Branch", ""),
|
||||
Include=Source.get("Include", ["**"]),
|
||||
@@ -213,8 +215,18 @@ def LoadProgram(Folder: Path) -> Program:
|
||||
|
||||
|
||||
def LoadPrograms() -> list[Program]:
|
||||
return [
|
||||
"""Alphabetical, with each program's children (Parent = its Name) right
|
||||
after it. A child whose parent isn't there keeps its own place."""
|
||||
Loaded = [
|
||||
LoadProgram(Folder)
|
||||
for Folder in sorted(ManifestsDir.iterdir())
|
||||
if (Folder / "Manifest.toml").exists()
|
||||
]
|
||||
Names = {Current.Name for Current in Loaded}
|
||||
Ordered = []
|
||||
for Current in Loaded:
|
||||
if Current.Parent in Names:
|
||||
continue
|
||||
Ordered.append(Current)
|
||||
Ordered.extend(Child for Child in Loaded if Child.Parent == Current.Name)
|
||||
return Ordered
|
||||
Reference in new issue
Block a user