summaryrefslogtreecommitdiff
path: root/xmake/plugins/macro/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-06-18 22:54:54 +0800
committerruki <[email protected]>2026-06-18 22:54:54 +0800
commit849606b78fe250ed3315fb65a085ca6c860ddcaf (patch)
tree2b49c22a80d475f258a59b73fb3533f0f4f353d7 /xmake/plugins/macro/xmake.lua
parent9b8df1e3c6bf7aa841c3c62f8f80d5016690367b (diff)
format menus
Diffstat (limited to 'xmake/plugins/macro/xmake.lua')
-rw-r--r--xmake/plugins/macro/xmake.lua107
1 files changed, 46 insertions, 61 deletions
diff --git a/xmake/plugins/macro/xmake.lua b/xmake/plugins/macro/xmake.lua
index 2a8710924..2cd022d6a 100644
--- a/xmake/plugins/macro/xmake.lua
+++ b/xmake/plugins/macro/xmake.lua
@@ -18,69 +18,54 @@
-- @file macro.lua
--
--- define task
task("macro")
-
- -- set category
set_category("plugin")
-
- -- on run
on_run("main")
-
- -- set menu
set_menu {
- -- usage
- usage = "xmake macro|m [options] [name] [arguments]"
-
- -- description
- , description = "Run the given macro."
-
- -- xmake m
- , shortname = 'm'
-
- -- options
- , options =
- {
- {'b', "begin", "k", nil, "Start to record macro."
- , "e.g."
- , "Record macro with name: test"
- , " xmake macro --begin"
- , " xmake config --plat=macosx"
- , " xmake clean"
- , " xmake -r"
- , " xmake package"
- , " xmake macro --end test" }
- , {'e', "end", "k", nil, "Stop to record macro." }
- , {}
- , {nil, "show", "k", nil, "Show the content of the given macro." }
- , {'l', "list", "k", nil, "List all macros." }
- , {'d', "delete", "k", nil, "Delete the given macro." }
- , {'c', "clear", "k", nil, "Clear the all macros." }
- , {}
- , {nil, "import", "kv", nil, "Import the given macro file or directory."
- , "e.g."
- , " xmake macro --import=/xxx/macro.lua test"
- , " xmake macro --import=/xxx/macrodir" }
- , {nil, "export", "kv", nil, "Export the given macro to file or directory."
- , "e.g."
- , " xmake macro --export=/xxx/macro.lua test"
- , " xmake macro --export=/xxx/macrodir" }
- , {}
- , {nil, "name", "v", ".", "Set the macro name."
- , "e.g."
- , " Run the given macro: xmake macro test"
- , " Run the anonymous macro: xmake macro ."
- , " Run the last command: xmake macro .."
- , values = function (complete, opt)
- -- hide in help menu
- if not complete then return end
- -- don't need name
- if opt.begin or opt.list or opt.clear then return end
- -- name should be given by user
- if opt["end"] or opt.import then return end
+ usage = "xmake macro|m [options] [name] [arguments]",
+ description = "Run the given macro.",
+ shortname = 'm',
+ options = {
+ {'b', "begin", "k", nil, "Start to record macro.",
+ "e.g.",
+ "Record macro with name: test",
+ " xmake macro --begin",
+ " xmake config --plat=macosx",
+ " xmake clean",
+ " xmake -r",
+ " xmake package",
+ " xmake macro --end test"},
+ {'e', "end", "k", nil, "Stop to record macro."},
+ {},
+ {nil, "show", "k", nil, "Show the content of the given macro."},
+ {'l', "list", "k", nil, "List all macros."},
+ {'d', "delete", "k", nil, "Delete the given macro."},
+ {'c', "clear", "k", nil, "Clear the all macros."},
+ {},
+ {nil, "import", "kv", nil, "Import the given macro file or directory.",
+ "e.g.",
+ " xmake macro --import=/xxx/macro.lua test",
+ " xmake macro --import=/xxx/macrodir"},
+ {nil, "export", "kv", nil, "Export the given macro to file or directory.",
+ "e.g.",
+ " xmake macro --export=/xxx/macro.lua test",
+ " xmake macro --export=/xxx/macrodir"},
+ {},
+ {nil, "name", "v", ".", "Set the macro name.",
+ "e.g.",
+ " Run the given macro: xmake macro test",
+ " Run the anonymous macro: xmake macro .",
+ " Run the last command: xmake macro ..",
+ values = function (complete, opt)
+ -- hide in help menu
+ if not complete then return end
+ -- don't need name
+ if opt.begin or opt.list or opt.clear then return end
+ -- name should be given by user
+ if opt["end"] or opt.import then return end
- return import("main.macros")(".")
- end }
- , {nil, "arguments", "vs", nil, "Set the macro arguments." }
- }
- }
+ return import("main.macros")(".")
+ end},
+ {nil, "arguments", "vs", nil, "Set the macro arguments."}
+ }
+ }