Can @JShell call another Jamal macro ? #22
-
Hi, In this @jshell example: https://github.com/verhas/jamal#user-content-xiii-jshell It is possible that such a @jshell script calls another macro ? My idea was to use @jschell to load a properties file, and then call a Jamal macro to generates XML content. Regards. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
JShell can do anything that a Java program can do, so in principle, nothing stops you from executing a macro from JShell. But this is not something you are looking for, and this possibility will not present a solution to your problem. The reason is that the JVM executes JShell in a separate process. So if you fire up a Jamal processor in that process and call some macro, it will be okay, but no effect on the actual process executing Jamal calling the JShell functions. To read properties, you do not need JShell. The https://github.com/verhas/jamal/tree/master/jamal-snippet#snip_properties macro does it for you. If that does not fit you for some reason, you can do the followings. Write a JShell script that reads the properties and stores the values in global JShell variables. When it is done, you can use |
Beta Was this translation helpful? Give feedback.
JShell can do anything that a Java program can do, so in principle, nothing stops you from executing a macro from JShell. But this is not something you are looking for, and this possibility will not present a solution to your problem.
The reason is that the JVM executes JShell in a separate process. So if you fire up a Jamal processor in that process and call some macro, it will be okay, but no effect on the actual process executing Jamal calling the JShell functions.
To read properties, you do not need JShell. The
https://github.com/verhas/jamal/tree/master/jamal-snippet#snip_properties
macro does it for you. If that does not fit you for some reason, you can do the followings.
Write a JS…