Snippet tools

This commit is contained in:
xzfc
2025-11-26 06:23:25 +00:00
parent 5517016d3b
commit c551dac79f
43 changed files with 2197 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
from pathlib import Path
from .base import CompileResult, Language, copy_template
class LanguageBash(Language):
NAME = "bash"
SNIPPET_FILENAME = "bash.sh"
@classmethod
def compile(cls, tmpdir: Path, fnames: list[Path]) -> CompileResult:
tmpdir.mkdir(parents=True)
result = CompileResult()
for no, fname in enumerate(fnames):
copy_template(fname, tmpdir / f"snippet{no}.sh")
result.run_args[fname] = ["bash", "-ex", f"{tmpdir}/snippet{no}.sh"]
return result