IonutParau 687cfebd00 testing version of LuaBIOS and OpenOS
people were having issues getting them to work so now we promote consistency
2025-06-28 20:41:49 +02:00

33 lines
772 B
Lua

--[[Lua implementation of the UN*X yes command--]]
local shell = require("shell")
local args, options = shell.parse(...)
if options.V or options.version then
io.write("yes v:1.0-3\n")
io.write("Inspired by functionality of yes from GNU coreutils\n")
return 0
end
if options.h or options.help then
io.write("Usage: yes [string]...\n")
io.write("OR: yes [-V/h]\n")
io.write("\n")
io.write("yes prints the command line arguments, or 'y', until is killed.\n")
io.write("\n")
io.write("Options:\n")
io.write(" -V, --version Version\n")
io.write(" -h, --help This help\n")
return 0
end
local msg = #args == 0 and 'y' or table.concat(args, ' ')
msg = msg .. '\n'
while io.write(msg) do
if io.stdout.tty then
os.sleep(0)
end
end
return 0