Closed PaulWoitaschek closed 11 months ago
Thinking of this, imagine what happens if you paste code into a promt 🙈
# rm -rf *
# rm -rf /
Mordant uses kotlin's readln function to get a line of input. I can see why it might be surprising, but this isn't a bug in mordant; that's just how shells work.
Pasting something in adds it to stdin, and if you didn't stop reading after encountering a line break, you wouldn't be able to know if there's any more input or not.
You could consider reading the clipboard directly from code, which would avoid that limitation.
I'd like to use a terminal.prompt to let users paste text. If it has line breaks, clikt will only take the first linebreak and the terminal will try to execute the following:
To reproduce, run this:
And paste the following text:
It will output: