From 917782999cfc8372cb76c764a61be9d33c7ea4ed Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 27 Jun 2020 13:37:33 +0200 Subject: [PATCH] doc [skip ci] --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 9e2bd1ae..242475c7 100644 --- a/README.md +++ b/README.md @@ -570,6 +570,14 @@ Babashka sets the following system properties: - `babashka.version`: the version string, e.g. `"1.2.0"` - `babashka.main`: the `--main` argument +- `babashka.file`: the `--file` argument (normalized using `.getCanonicalPath`) + +## __name__ = "__main__" pattern + +In Python scripts there is a well-known pattern to check if the current file was +the file invoked from the command line: `__name__ = "__main__" pattern`. In +babashka this pattern can be implemented using `(= *file* (System/getProperty +"babashka.file")`. ## Data readers