feat: profiles rename_profile

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 19:51:52 +02:00
parent 9a0128b5fa
commit 71462071e4
2 changed files with 26 additions and 0 deletions
+13
View File
@@ -57,3 +57,16 @@ def create_profile(base, name, pid, ts=0):
reg["profiles"].append(entry)
write_registry(base, reg)
return entry
def rename_profile(base, pid, name):
reg = read_registry(base)
entry = find_by_id(reg, pid)
if not entry:
raise KeyError(pid)
other = find_by_name(reg, name)
if other and other["id"] != pid:
raise ValueError(f"profile name already exists: {name}")
entry["name"] = name
write_registry(base, reg)
return entry