feat: allow code snippet execution in any language #253
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the groundwork to be able to allow code execution for any supported language rather than just bash scripts by using the
+exec
switch. The idea is that we files in the repo's./executors
directory where the file name should be<CodeLanguage>.sh
and should contain a shell script that indicates how that programming language is executed. The script will be invoked when a code snippet for that language is executed, taking as an argument the path to a file that contains the code snippet.For interpreted languages like python the executor may be a script that contains a single line invoking the interpreter. For compiled languages it may contain an invocation to the compiler + one to the output binary.
Besides built in executors, you can define executors locally in
$config_path/executors
(~/.config/presenterm
in linux) where each file should follow that naming format ^.There's still more work to be done to:
python
finishes. I think something is using buffered output and is causing us to only receive the script's output once it finishes.Relates to #242