diff --git a/memo b/memo index 224409b..4a725dc 100755 --- a/memo +++ b/memo @@ -838,6 +838,13 @@ def main(): print("No such command: %s\n" % cmd, file=sys.stderr) print(usage, file=sys.stderr) sys.exit(1) + if cmd == "note" and not os.environ.get("MEMO_UNGATED"): + # An optional host hook beside the store may classify or refuse a note + # before it is written. It records accepted notes itself by calling + # back with MEMO_UNGATED=1, so this check never recurses. + gate = os.path.join(os.path.dirname(memory_dir()), "note-gate") + if os.access(gate, os.X_OK): + os.execv(gate, [gate] + sys.argv[2:]) try: # `init` is the only command that may run without an existing memory: # it is the one that creates it. Every other command refuses, so a