131a10dd0be3 — Arne Babenhauserheide 6 years ago
add extra section for shell-deferring
1 files changed, 21 insertions(+), 0 deletions(-)

M py2guile.org
M py2guile.org +21 -0
@@ 1160,6 1160,27 @@ (package module) function)=. A script-runner with some error information would be the following script:
              (basename cmd))))
 #+END_SRC
 
+For small projects, however, like short utility scripts,
+shell-deferring gives you most flexibility.
+
+***** Run script via shell-deferring
+
+#+name: runscript-shell-module-wisp2
+#+BEGIN_SRC sh
+  #!/bin/sh
+  # -*- wisp -*-
+  exec guile -L $(dirname $(dirname $(realpath "$0"))) \
+       --language=wisp -e '(@ (py2guile runscript) main)' \
+       -s "$0" "$@"
+  # use @@ if your module does not export main
+  ; !#
+  define-module : py2guile runscript
+                . #:export (main)
+  define : main args
+    display "Running you Module!\n"
+#+END_SRC
+
+
 ***** Where am I?
 
 A more complex example asks, in which file a function I am using is defined. In Python, this works roughly like this: