diff --git a/amanuensis/cli/helpers.py b/amanuensis/cli/helpers.py index 9ea48c3..27765db 100644 --- a/amanuensis/cli/helpers.py +++ b/amanuensis/cli/helpers.py @@ -83,11 +83,11 @@ def config_get(cfg, pathspec): cfg = cfg.get(spec) print(json.dumps(cfg, indent=2)) -def config_set(cfg, set_tuple): +def config_set(obj_id, cfg, set_tuple): """ Performs config --set for a given config - config is from a with json_rw context + config is from a "with json_rw" context set_tuple is a tuple of the pathspec and the value """ import json @@ -109,4 +109,6 @@ def config_set(cfg, set_tuple): if key not in cfg: logger.error("Path not found") return -1 - cfg[key] = value \ No newline at end of file + old_value = cfg[key] + cfg[key] = value + logger.info("{}.{}: {} -> {}".format(obj_id, pathspec, old_value, value)) \ No newline at end of file diff --git a/amanuensis/cli/lexicon.py b/amanuensis/cli/lexicon.py index 41a8018..74becbb 100644 --- a/amanuensis/cli/lexicon.py +++ b/amanuensis/cli/lexicon.py @@ -110,7 +110,7 @@ def command_config(args): if args.set: with json_rw(lex.config_path) as cfg: - config_set(cfg, args.set) + config_set(lex.id, cfg, args.set) # # Player/character commands diff --git a/amanuensis/cli/server.py b/amanuensis/cli/server.py index 57876fb..9aa1a2e 100644 --- a/amanuensis/cli/server.py +++ b/amanuensis/cli/server.py @@ -90,4 +90,4 @@ def command_config(args): if args.set: with config.json_rw('config.json') as cfg: - config_set(cfg, args.set) + config_set("config", cfg, args.set) diff --git a/amanuensis/cli/user.py b/amanuensis/cli/user.py index 7ac77d0..3697d91 100644 --- a/amanuensis/cli/user.py +++ b/amanuensis/cli/user.py @@ -99,7 +99,7 @@ def command_config(args): if args.set: with config.json_rw('user', u.id, 'config.json') as cfg: - config_set(cfg, args.set) + config_set(u.id, cfg, args.set) @add_argument("--username", help="The user to change password for") def command_passwd(args):