changed installer press enter to continue to any key, fixed some text colors

This commit is contained in:
Mikayla Fischler 2023-07-16 20:53:39 -04:00
parent 2a541ef3fe
commit 5529774b0e
2 changed files with 16 additions and 10 deletions

View File

@ -20,7 +20,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
local function println(message) print(tostring(message)) end local function println(message) print(tostring(message)) end
local function print(message) term.write(tostring(message)) end local function print(message) term.write(tostring(message)) end
local CCMSI_VERSION = "v1.6" local CCMSI_VERSION = "v1.7"
local install_dir = "/.install-cache" local install_dir = "/.install-cache"
local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/" local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/"
@ -55,6 +55,10 @@ local function ask_y_n(question, default)
else return nil end else return nil end
end end
-- wait for any key to be pressed
---@diagnostic disable-next-line: undefined-field
local function any_key() os.pullEvent("key") end
-- print out a white + blue text message -- print out a white + blue text message
local function pkg_message(message, package) white();print(message .. " ");blue();println(package);white() end local function pkg_message(message, package) white();print(message .. " ");blue();println(package);white() end
@ -156,11 +160,11 @@ local function _clean_dir(dir, tree)
if fs.isDir(path) then if fs.isDir(path) then
_clean_dir(path, tree[val]) _clean_dir(path, tree[val])
if #fs.list(path) == 0 then if #fs.list(path) == 0 then
fs.delete(path);red();println("deleted dir " .. path);white() fs.delete(path);lgray();println("deleted dir " .. path);white()
end end
elseif not _in_array(val, tree) then elseif not _in_array(val, tree) then
fs.delete(val) fs.delete(val)
red();println("deleted " .. path);white() lgray();println("deleted " .. path);white()
end end
end end
end end
@ -449,8 +453,9 @@ elseif mode == "install" or mode == "update" then
if mode == "install" then if mode == "install" then
println("Installation completed successfully.") println("Installation completed successfully.")
else println("Update completed successfully.") end else println("Update completed successfully.") end
println("Ready to clean up unused files, press enter to continue...") white();println("Ready to clean up unused files, press any key to continue...")
read();clean(manifest) any_key();clean(manifest)
white();println("Done.")
else else
if mode == "install" then if mode == "install" then
red();println("Installation failed.") red();println("Installation failed.")
@ -491,8 +496,9 @@ elseif mode == "install" or mode == "update" then
if mode == "install" then if mode == "install" then
println("Installation completed successfully.") println("Installation completed successfully.")
else println("Update completed successfully.") end else println("Update completed successfully.") end
println("Ready to clean up unused files, press enter to continue...") white();println("Ready to clean up unused files, press any key to continue...")
read();clean(manifest) any_key();clean(manifest)
white();println("Done.")
else else
red() red()
if mode == "install" then if mode == "install" then
@ -542,8 +548,8 @@ elseif mode == "remove" or mode == "purge" then
if not log_deleted then if not log_deleted then
red();println("failed to delete log file") red();println("failed to delete log file")
white();println("press enter to continue...") white();println("press any key to continue...")
read();lgray() any_key();lgray()
end end
end end

File diff suppressed because one or more lines are too long