Branching off #18.
Original implementation from March 2020 in #57 by @apple502j (thanks!). This will need some revisiting to bring it up to date (e.g. conflicting files) but the essential implementation should still work.
There's also #93 by @reinertd (thank you!) which rebases #57 with fairly recent commits. Still a conflict, but it's much simpler to resolve (it and a more recent commit both append code to the same two areas in existing files).