mirror of
https://github.com/RasppleII/a2server.git
synced 2025-03-11 15:29:48 +00:00
The info text for askYesNo was a problem. First, it involved a long, complex, paragraph encoded as string on the command line. That's NEVER a good idea. Secondly, it passed that string unprocessed to printf (albeit printf(1) but still) as a format string. And third, there's no way to manage line length when you're doing that. The alternative is to put the strings in a here document. We then cat the result between a couple of empty echo commands to create the original output. This addresses all of the above issues, but creates a new one: The info text follows the prompt, rather than the other way around. Not the most elegant. So … why do this at all, why not just echo the info text outside of the function, particularly since the function only echoes it once no matter how many times you give a bogus answer? Well, if at some point we decide to implement a dialog-type interface (whiptail, zenity, whatever you prefer), then it becomes easy to do so. Unsure that's desirable at this time, but options are good.