You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is my plugin task.
`task("pika_compile")
set_category("plugin")
-- 设置插件的命令行选项
set_menu {
usage = "xmake pika_compile [options]",
description = "PikaScript Compile",
options = {
{'h', "help", "k", nil, "Display help information."},
{'f', "file", "kv", nil, "Specify the input file to compile."},
{'o', "output", "kv", nil, "Specify the output file."},
{'c', "compile-file", "kv", nil, "Compile only."},
{},
{nil, "contents", "vs", nil, "The options for the compile command."}
}
}
-- 设置运行脚本
on_run(function ()
import("core.base.option")
local pika_path = "./pikapython"
local compile_exe = "rust-msc-latest-win10.exe"
local args = {}
-- 检查是否需要显示帮助信息
if option.get("help") or option.get("h") then
-- 如果请求帮助,直接执行 rust-msc-latest-win10.exe -h
print("Executing: " .. compile_exe .. " -h")
os.execv(compile_exe, {"-h"})
return -- 确保后续代码不再执行
end
-- 获取输入文件参数
local input_file = option.get("compile-file")
if input_file then
table.insert(args, "-c")
table.insert(args, input_file)
end
-- 获取输出参数
local output = option.get("output")
if output then
table.insert(args, "-o")
table.insert(args, output)
end
-- 获取文件参数
local file = option.get("file")
if file then
table.insert(args, file)
end
-- 获取其他内容参数
local contents = option.get("contents")
if contents then
for _, content in ipairs(contents) do
table.insert(args, content)
end
end
-- 打印最终的 args 列表
print("PikaScript Compile with arguments:", table.concat(args, " "))
os.cd(pika_path)
-- 执行程序
os.execv(compile_exe, args)
end)
**When I execute xmake pika_python -h , the result I expect should be as follows:**.\rust-msc-latest-win10.exe -h
Usage:
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe - [Binding C modules and compile all from main.py]
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe test.py - [Compile all from test.py]
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe test.py -o out.a - [Compile all from test.py and link to out.a]
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe -c test.py - [Only compile test.py to test.py.o]
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe -c test.py -o out.o - [Only compile test.py to
out.o]`
However,The -h option is always captured by xmake and the output is as follows,do you have any advice?
==========================================================================
| A new version of xmake is available! |
| |
| To update to the latest version v2.9.9, run "xmake update". |
Usage: $xmake pika_compile [options]
PikaScript Compile
Common options:
-q, --quiet Quiet operation.
-y, --yes Input yes by default if need user confirm.
--confirm=CONFIRM Input the given result if need user confirm.
- yes
- no
- def
-v, --verbose Print lots of verbose information for users.
--root Allow to run xmake as root.
-D, --diagnosis Print lots of diagnosis information (backtrace, check
info ..) only for developers.
And we can append -v to get more whole information.
e.g. $ xmake -vD
-h, --help Print this help message and exit.
-F FILE, --file=FILE Read a given xmake.lua file.
-P PROJECT, --project=PROJECT Change to the given project directory.
Search priority:
1. The Given Command Argument
2. The Envirnoment Variable: XMAKE_PROJECT_DIR
3. The Current Directory
Command options (pika_compile):
-h, --help Display help information.
-f FILE, --file=FILE Specify the input file to compile.
-o OUTPUT, --output=OUTPUT Specify the output file.
-c COMPILE-FILE, --compile-file=COMPILE-FILE Compile only.
contents ... The options for the compile command.`
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Here is my plugin task.
`task("pika_compile")
set_category("plugin")
**When I execute xmake pika_python -h , the result I expect should be as follows:**
.\rust-msc-latest-win10.exe -hUsage:
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe - [Binding C modules and compile all from main.py]
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe test.py - [Compile all from test.py]
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe test.py -o out.a - [Compile all from test.py and link to out.a]
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe -c test.py - [Only compile test.py to test.py.o]
E:\Pikapython_demo\pikapython\rust-msc-latest-win10.exe -c test.py -o out.o - [Only compile test.py to
out.o]`
However,The -h option is always captured by xmake and the output is as follows,do you have any advice?
`xmake pika_compile -h
xmake v2.9.8+HEAD.13fc39238, A cross-platform build utility based on Lua
Copyright (C) 2015-present Ruki Wang, tboox.org, xmake.io
_
__ ___ __ __ __ | | ______
\ / / | / |/ _ | |/ / __
> < | _/ | /| | < /
//__|| ||_ ||____|
by ruki, xmake.io
==========================================================================
| A new version of xmake is available! |
| |
| To update to the latest version v2.9.9, run "xmake update". |
Usage: $xmake pika_compile [options]
PikaScript Compile
Common options:
-q, --quiet Quiet operation.
-y, --yes Input yes by default if need user confirm.
--confirm=CONFIRM Input the given result if need user confirm.
- yes
- no
- def
-v, --verbose Print lots of verbose information for users.
--root Allow to run xmake as root.
-D, --diagnosis Print lots of diagnosis information (backtrace, check
info ..) only for developers.
And we can append -v to get more whole information.
e.g. $ xmake -vD
-h, --help Print this help message and exit.
Command options (pika_compile):
-h, --help Display help information.
-f FILE, --file=FILE Specify the input file to compile.
-o OUTPUT, --output=OUTPUT Specify the output file.
-c COMPILE-FILE, --compile-file=COMPILE-FILE Compile only.
Beta Was this translation helpful? Give feedback.
All reactions