provide optional arguments to set the path root and thetexinputs variable in edit command

This commit is contained in:
Maximilian Keßler 2021-09-18 14:16:53 +02:00
parent 49689e4dd0
commit d028139860

View File

@ -2,11 +2,17 @@
import subprocess
from pathlib import Path
import os
def edit(filepath: Path):
def edit(filepath: Path, rootpath: Path = None, texinputs=None):
env = dict(os.environ)
if texinputs:
env["TEXINPUTS"] = texinputs
if not rootpath:
rootpath = filepath
subprocess.Popen([
"termite",
"-e",
f"vim --servername tex-vorlesung --remote-silent {str(filepath)}"
])
], env=env, cwd=str(rootpath.root))