Kipper
Kipper copied to clipboard
[Feature] Add support for shebangs that can be used to invoke the Kipper CLI or any interpreter in the transpiled form
Is there an existing proposal for this?
- [X] I have searched the existing issues
This feature does not exist in the latest version
- [X] I am using the latest version
Proposal
Add support for shebangs which should allow an easier invocation of the Kipper CLI run command or a different interpreter in the compiled form. These should reference an executable interpreter which will process the given file.
Potential shebang usages (On Linux - MacOS excluded for now):
- Easier invocation of the Kipper CLI:
#!/usr/bin/env kipper run [other args...] print("Hello world!");
- Easier invocation for node or ts-node in the transpiled output form (The Kipper compiler will preserve the shebang unless explicitly told not to):
Transpiled:#!/usr/bin/env node [other args...] print("Hello world!");
#!/usr/bin/env node [other args...] ... __kipper.print("Hello world!");
Additionally, besides the shebang itself, there should be a compilation argument --preserve-shebang
which should tell the compiler whether to remove or keep the shebang in the output code.
Exact behaviour / changes you want
- Implement compiler support for parsing and interpreting shebangs.
- Add argument
--preserve-shebang
to the CLI and the compiler API, which tells the compiler whether to preserve the shebang or not. - Ensure the Kipper CLI works with the shebang style as shown above in the proposal section.