diff options
| author | ruki <[email protected]> | 2017-05-10 08:45:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-10 08:45:22 +0800 |
| commit | 1d94a23a7db35631f4b33b8b0b3968d0e62ffe2a (patch) | |
| tree | 369ae0ec06074ec28c944eaaca94e69db02a25b6 /docs/plugins.md | |
| parent | d80214fcfaa2f90b2ba6ec6991329d38901cff66 (diff) | |
improve doc for xmake lua pluginv2.1.4
Diffstat (limited to 'docs/plugins.md')
| -rw-r--r-- | docs/plugins.md | 64 |
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 |
