summaryrefslogtreecommitdiff
path: root/docs/plugins.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/plugins.md')
-rw-r--r--docs/plugins.md64
1 files changed, 64 insertions, 0 deletions
diff --git a/docs/plugins.md b/docs/plugins.md
index 0c81b2fbc..8091f1456 100644
--- a/docs/plugins.md
+++ b/docs/plugins.md
@@ -338,6 +338,8 @@ end
#### Run the Custom Lua Script
+##### Run the given script
+
Write a simple lua script:
```lua
@@ -356,6 +358,68 @@ $ xmake lua /tmp/test.lua
You can also use `import` api to write a more advance lua script.
</p>
+##### Run the builtin script
+
+You can run `xmake lua -l` to list all builtin script name, for example:
+
+```bash
+$ xmake lua -l
+scripts:
+ cat
+ cp
+ echo
+ versioninfo
+ ...
+```
+
+And run them:
+
+```bash
+$ xmake lua cat ~/file.txt
+$ xmake lua echo "hello xmake"
+$ xmake lua cp /tmp/file /tmp/file2
+$ xmake lua versioninfo
+```
+
+##### Run interactive commands (REPL)
+
+Enter interactive mode:
+
+```bash
+$ xmake lua
+> 1 + 2
+3
+
+> a = 1
+> a
+1
+
+> for _, v in pairs({1, 2, 3}) do
+>> print(v)
+>> end
+1
+2
+3
+```
+
+And we can `import` modules:
+
+```bash
+> task = import("core.project.task")
+> task.run("hello")
+hello xmake!
+```
+
+If you want to cancel multiline input, please input character `q`, for example:
+
+```bash
+> for _, v in ipairs({1, 2}) do
+>> print(v)
+>> q <-- cancel multiline and clear previous input
+> 1 + 2
+3
+```
+
#### Generate IDE Project Files
##### Generate Makefile