#61 monitor configuration and init, render engine started, dmesg changes, ppm monitor listing changes

This commit is contained in:
Mikayla Fischler
2022-05-29 14:34:09 -04:00
parent ff5b163c1d
commit e65a1bf6e1
8 changed files with 333 additions and 23 deletions

View File

@@ -0,0 +1,45 @@
local completion = require("cc.completion")
local util = require("scada-common.util")
local print = util.print
local println = util.println
local print_ts = util.print_ts
local println_ts = util.println_ts
local dialog = {}
function dialog.ask_y_n(question, default)
print(question)
if default == true then
print(" (Y/n)? ")
else
print(" (y/N)? ")
end
local response = read(nil, nil)
if response == "" then
return default
elseif response == "Y" or response == "y" then
return true
elseif response == "N" or response == "n" then
return false
else
return nil
end
end
function dialog.ask_options(options, cancel)
print("> ")
local response = read(nil, nil, function(text) return completion.choice(text, options) end)
if response == cancel then return false end
if util.table_contains(options, response) then
return response
else return nil end
end
return dialog