local cmd, arg, options, devices = ... local function select_prompt(devs, prompt) table.sort(devs, function(a, b) return a.path 0 and number <= num_devs then return devs[number] else io.write("Invalid input, please try again: ") os.sleep(0) end end print("\ntoo many bad inputs, aborting") os.exit(1) end if cmd == "select" then if arg == "sources" then if #devices == 0 then if options.label then io.stderr:write("Nothing to install labeled: " .. options.label .. '\n') elseif options.from then io.stderr:write("Nothing to install from: " .. options.from .. '\n') else io.stderr:write("Nothing to install\n") end os.exit(1) end return select_prompt(devices, "What do you want to install?") elseif arg == "targets" then if #devices == 0 then if options.to then io.stderr:write("No such target to install to: " .. options.to .. '\n') else io.stderr:write("No writable disks found, aborting\n") end os.exit(1) end return select_prompt(devices, "Where do you want to install to?") end end