aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/__main__.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/argaze/__main__.py b/src/argaze/__main__.py
index cb8bd01..926d572 100644
--- a/src/argaze/__main__.py
+++ b/src/argaze/__main__.py
@@ -268,20 +268,20 @@ def load_context(args):
logging.info('%s pipe closed', args.pipe_path)
-def patch_file(args):
+def edit_file(args):
"""
- Patch a JSON file according a JSON patch into a JSON output file.
+ Edit a JSON file according a JSON changes file into a JSON output file.
"""
# Open JSON files
- with open(args.file) as file, open(args.patch) as patch, open(args.output, 'w', encoding='utf-8') as output:
+ with open(args.file) as file, open(args.changes) as changes, open(args.output, 'w', encoding='utf-8') as output:
import collections.abc
import json
# Load unique object
file_data = json.load(file)
- patch_data = json.load(patch)
+ changes_data = json.load(changes)
def update(d, u):
@@ -301,7 +301,7 @@ def patch_file(args):
return d
- new_data = update(file_data, patch_data)
+ new_data = update(file_data, changes_data)
# Write new data
json.dump(new_data, output, ensure_ascii=False, indent=' ')
@@ -318,11 +318,11 @@ parser_load.add_argument('-x', '--display', metavar='DISPLAY', nargs="+", type=i
parser_load.add_argument('--no-window', action='store_true', default=False, help='disable window mode')
parser_load.set_defaults(func=load_context)
-parser_patch = subparsers.add_parser('patch', help=patch_file.__doc__)
+parser_patch = subparsers.add_parser('edit', help=edit_file.__doc__)
parser_patch.add_argument('file', metavar='FILE', type=str, default=None, help='json file path')
-parser_patch.add_argument('patch', metavar='PATCH', type=str, default=None, help='json patch path')
+parser_patch.add_argument('changes', metavar='CHANGES', type=str, default=None, help='json changes path')
parser_patch.add_argument('output', metavar='OUTPUT', type=str, default=None, help='json output path')
-parser_patch.set_defaults(func=patch_file)
+parser_patch.set_defaults(func=edit_file)
args = parser.parse_args()
args.func(args)