From f71419820f4d6a4f9beec1d7cd7e5b9196c6248d Mon Sep 17 00:00:00 2001 From: Rick Rongen Date: Mon, 18 Feb 2019 11:21:06 +0100 Subject: [PATCH] Added basic delete support --- Crx/patchbuilder.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Crx/patchbuilder.py b/Crx/patchbuilder.py index 62fac02..e240198 100644 --- a/Crx/patchbuilder.py +++ b/Crx/patchbuilder.py @@ -20,8 +20,13 @@ def _build_patch_set(change: dict) -> str: return ''.join(line) +def _build_patch_delete(change: dict) -> str: + return f'-{change["path"]} : ' + + _patch_builders = { - 'set': _build_patch_set + 'set': _build_patch_set, + 'delete': _build_patch_delete, } @@ -41,6 +46,13 @@ class PatchBuilder: 'type': value_type }) + def delete_node(self, path: str): + self.changes.append({ + 'action': 'delete', + 'path': path + }) + pass + def save(self): patch = [] for entry in self.changes: