如何将 2 个参数传递给 Nant 脚本?
我必须编写一个 Nant 脚本,该脚本将在命令行上接受 2 个参数。第一个只是一个选项,具有以下格式:-myOption。第二个需要用引号引起来:“带有空格的某些值”。
例如 -myOption "this value"
我是 Nant 的新手,所以到目前为止我还没有成功,并且不知道如何输出命令进行调试。
这是我到目前为止所拥有的:
<target name="Build" depends="SetupConfig">
<exec workingdir="${refactory.basedir}" program="${exe.name.mfg.factory}" basedir="${refactory.basedir}" commandline="-myOption:">
<arg>${refactory.clientconfig}</arg>
</exec>
我正在尝试使用“commandline”属性和 args 嵌套元素创建命令。 args 元素应该提供 qoutes。
有人可以告诉我这应该是什么样子吗?谢谢。
I have to write an Nant script that will accept 2 parameters on the command line. The first is just an option and has the following format: -myOption. The second one needs to be wrapped in quotes: "some value with space".
e.g. -myOption "this value"
I am new to Nant so I have unsuccessful so far and don't know how to output the command to debug.
This is what I have so far:
<target name="Build" depends="SetupConfig">
<exec workingdir="${refactory.basedir}" program="${exe.name.mfg.factory}" basedir="${refactory.basedir}" commandline="-myOption:">
<arg>${refactory.clientconfig}</arg>
</exec>
I am attempting to create the command using the "commandline"' attribute and the args nested element. The args element is supposed to provide qoutes.
Can some tell me how this should look? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我需要承认,看看你的代码片段,我并不完全清楚你想要实现什么。
无论如何,这就是将两个参数传递给 NAnt 脚本的方式(您对问题标题的要求):
给定一个 NAnt 脚本
example.project.build
,其内容如下:...您可以调用
... 来执行脚本
example.project.build
并将参数arg.option
和arg.whitespace
传递给它。I need to confess, looking at your code snippet it's not completely clear to me, what You are trying to achieve.
Anyway, this is how you pass two arguments to a NAnt script (what You're claiming for regarding to the question's title):
Given a NAnt script
example.project.build
with following content:... you would call
... to execute script
example.project.build
and pass argumentsarg.option
andarg.whitespace
to it.试试这个:
有关详细信息,请查看 Nant Exec 任务文档。
Try this:
For more information view Nant Exec task documentation.