Output of task by default look like that:
target name:
[input] some message:
your input
[next task]
I’d like to see something like this:
target name:
[input] some message: your input
[next task]
How can I make, that task does not put cursor to the new line after message?
It can be done, but it is a little bit involved. There is no option on the
inputtask itself for easily doing what you want.However, in Ant 1.7 or greater, you can control the output (and input) of the
inputtask by providing an input handler. Ant comes shipped with a few input handlers, for example one for secure input that does not echo what you type to the screen. You can, if you want, write your own input handler, and in that way gain full control of what input and output looks like.To write an input handler you must write a class that implements the
InputHandlerinterface. I recommend you download the Ant source code and take a look at theDefaultInputHandlerand create your own version of that, modifying it to suit your needs. In the source for Ant v1.8.3, the prompt and input is implemented like this:I haven’t tried it, but changing the
printlnto aprintseems like a good idea.When done, you can point Ant’s
inputtask to your compiled input handler using theclassnameand (for instance)classpathparameters.