(path: str, content: str)
| 23 | return f"[ERROR] Could not write {path}: {e}" |
| 24 | |
| 25 | def append_file(path: str, content: str) -> str: |
| 26 | try: |
| 27 | p = Path(path).expanduser().resolve() |
| 28 | with open(p, "a", encoding="utf-8") as f: |
| 29 | f.write(content) |
| 30 | return f"Appended {len(content)} chars to {p}" |
| 31 | except Exception as e: |
| 32 | return f"[ERROR] {e}" |
| 33 | |
| 34 | def list_dir(path: str = ".") -> str: |
| 35 | """List directory contents.""" |