Skip to content

Implement delete_key() API for removing keys#1

Merged
ryan-williams merged 1 commit into
mainfrom
rw/del
Nov 1, 2025
Merged

Implement delete_key() API for removing keys#1
ryan-williams merged 1 commit into
mainfrom
rw/del

Conversation

@ryan-williams

Copy link
Copy Markdown
Member

Features:

  • Delete entire key-value pair (key, colon, value, inline comment, newline)
  • Delete comment lines immediately preceding key (same indentation)
  • Delete trailing blank line to prevent double spacing
  • Preserve comments separated by blank lines
  • Return bool for success/failure
  • Raise ValueError when attempting to delete root
  • Handle nested mappings and lists as values

Added 11 comprehensive tests covering:

  • Simple scalar deletion
  • Nested mappings and lists
  • Comment preservation
  • Inline comment deletion
  • Blank line handling
  • Multiple deletions
  • Deep nested keys
  • Edge cases (nonexistent keys, last key, root)

🤖 Generated with Claude Code

Features:
- Delete entire key-value pair (key, colon, value, inline comment, newline)
- Delete comment lines immediately preceding key (same indentation)
- Delete trailing blank line to prevent double spacing
- Preserve comments separated by blank lines
- Return bool for success/failure
- Raise ValueError when attempting to delete root
- Handle nested mappings and lists as values

Added 11 comprehensive tests covering:
- Simple scalar deletion
- Nested mappings and lists
- Comment preservation
- Inline comment deletion
- Blank line handling
- Multiple deletions
- Deep nested keys
- Edge cases (nonexistent keys, last key, root)

All 65 tests passing.

Implements specs/delete_key.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ryan-williams ryan-williams merged commit dce37cc into main Nov 1, 2025
5 checks passed
@ryan-williams ryan-williams deleted the rw/del branch November 1, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant