Added basic delete support

This commit is contained in:
Rick Rongen
2019-02-18 11:21:06 +01:00
parent 6e7ee89148
commit f71419820f

View File

@@ -20,8 +20,13 @@ def _build_patch_set(change: dict) -> str:
return ''.join(line) return ''.join(line)
def _build_patch_delete(change: dict) -> str:
return f'-{change["path"]} : '
_patch_builders = { _patch_builders = {
'set': _build_patch_set 'set': _build_patch_set,
'delete': _build_patch_delete,
} }
@@ -41,6 +46,13 @@ class PatchBuilder:
'type': value_type 'type': value_type
}) })
def delete_node(self, path: str):
self.changes.append({
'action': 'delete',
'path': path
})
pass
def save(self): def save(self):
patch = [] patch = []
for entry in self.changes: for entry in self.changes: