[英]Jira Groovy Runner ask for user input
I was wondering if there was a way to have the Jira Script Runner allow some sort of user input whether in the form of when entering the file location and then adding the input ie "C:/fakepath/myScript.groovy -my input" Even better would have it create a input box. 我想知道是否有一种方法可以让Jira Script Runner允许某种形式的用户输入,无论是以输入文件位置然后添加输入的形式,即“ C:/fakepath/myScript.groovy -my输入”,甚至最好让它创建一个输入框。
I am asking because I want to create a script to create a bunch of jira issues base upon the user input. 我之所以问是因为我想创建一个脚本来根据用户输入创建一堆jira问题。 I realize I could just create a string instead of the user input and then just edit the code each time I use it, but it would be much more efficient if I didn't have to do that.
我意识到我可以创建一个字符串而不是用户输入,然后在每次使用它时都编辑代码,但是如果不必这样做,它会更加高效。 If groovy in jira can do such a thing that would be great.
如果jira中的Groovy可以做这样的事情,那就太好了。
I tried using the following: 我尝试使用以下内容:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in))
print "Input:"
def userInput = br.readLine()
println "You entered: $userInput"
but it just constantly runs waiting for the user input, but nothing pop-ups where I could enter it. 但是它只是不断运行以等待用户输入,但是没有弹出窗口可以输入。
Thanks for the help! 谢谢您的帮助!
The following code works 以下代码有效
println "Input:"
BufferedReader br = new BufferedReader(new InputStreamReader(System.in))
def userInput = br.readLine()
println "You entered: $userInput"
My guess is your program is waiting for input, but it has not printed the message due to buffering. 我的猜测是您的程序正在等待输入,但是由于缓冲,它没有打印出消息。
http://www.emoticode.net/groovy/console-input-read-in-groovy.html http://www.emoticode.net/groovy/console-input-read-in-groovy.html
System.in.withReader {
println "Test: "
carrier = it.readLine()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.