Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow code snippet execution in any language #253

Merged
merged 6 commits into from
May 27, 2024

Conversation

mfontanini
Copy link
Owner

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:

  1. Add a lot more executors. This simply adds python as a showcase but adding more should now be trivial for contributors.
  2. Allow defining executors within the presentation's path so that you can have a self contained reproducible presentation.
  3. Allow processing output in real time as you now only see output when 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

executors/Python.sh Outdated Show resolved Hide resolved
mfontanini and others added 2 commits May 27, 2024 08:06
@mfontanini mfontanini changed the title feat: allow code execution beyond shell scripts feat: allow code snippet execution in any language May 27, 2024
@mfontanini mfontanini merged commit 6ef75f8 into master May 27, 2024
6 checks passed
@mfontanini mfontanini deleted the feat/lang-execution branch May 27, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants