Initial version of the E-Invoice solution of JR IT Services

This commit is contained in:
2026-02-16 17:02:03 +01:00
commit e0c15fc7f2
36 changed files with 1407 additions and 0 deletions

20
jr_einvoice/editor.py Normal file
View File

@@ -0,0 +1,20 @@
from __future__ import annotations
import os
import shutil
import subprocess
from pathlib import Path
def open_in_editor(path: Path, logger) -> None:
# Prefer $EDITOR, then common editors
editor = os.environ.get("EDITOR")
if not editor:
for cand in ["code", "codium", "nano", "vim", "vi"]:
if shutil.which(cand):
editor = cand
break
if not editor:
raise RuntimeError("No editor found. Set $EDITOR or install nano/vim/code.")
logger.info("Opening editor: %s %s", editor, path)
# Split editor if it contains args (simple)
parts = editor.split()
subprocess.run(parts + [str(path)], check=False)