我正在尝试将命令行参数传递给grails运行命令,例如“ -db = dbname -force”等。它看起来好像没有正确解析。.
这是一个简单的命令
class SampleCommand implements GrailsApplicationCommand {
boolean handle() {
System.out.println("Raw args:" + executionContext.commandLine.getRawArguments())
System.out.println("Remaining Args: " + args);
System.out.println("Undeclared Options:" + executionContext.commandLine.getUndeclaredOptions() )
System.out.println("System properties:" + executionContext.commandLine.getSystemProperties() )
return true;
}
}
我正在尝试按以下方式运行
$ grails运行命令示例arg1 arg2 -option = val arg4
这是输出
Raw args:[sample, arg1, arg2, arg4]
Remaining Args: [arg1, arg2, arg4]
Undeclared Options:[:]
System properties:[:]
我在任何地方都找不到“ 选项”参数及其“ val ”。