Return the updated ~/.claude.json from mark_trusted
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
from loop_claude.claude_code.formats import mark_trusted, trust_records
|
||||
from loop_claude.claude_code.formats import mark_trusted
|
||||
from loop_claude.file_writes import replace_json
|
||||
from loop_claude.outcome import Failure
|
||||
|
||||
@@ -13,14 +13,14 @@ def trust(config, roots):
|
||||
except (OSError, ValueError) as failure:
|
||||
print(f"could not read {config}: {getattr(failure, 'strerror', failure)}", file=sys.stderr)
|
||||
return
|
||||
projects = trust_records(data)
|
||||
if isinstance(projects, Failure):
|
||||
print(f"could not read {config}: {projects.reason}", file=sys.stderr)
|
||||
marked = mark_trusted(data, roots)
|
||||
if isinstance(marked, Failure):
|
||||
print(f"could not read {config}: {marked.reason}", file=sys.stderr)
|
||||
return
|
||||
untrusted = mark_trusted(projects, roots)
|
||||
updated, untrusted = marked
|
||||
if not untrusted:
|
||||
return
|
||||
if failure := replace_json(config, data, indent=2):
|
||||
if failure := replace_json(config, updated, indent=2):
|
||||
print(f"could not write {config}: {failure.reason}", file=sys.stderr)
|
||||
return
|
||||
print("trusted for the interrupt: " + ", ".join(untrusted), file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user