summaryrefslogtreecommitdiff
path: root/xmake/actions/install/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-09-20 22:43:55 +0800
committerruki <[email protected]>2017-09-20 10:23:34 +0800
commit29d8859222252ffa54536c0d324290a0c9f2eb41 (patch)
treedaf38b4f51fcdfafc388edbcb96107ce30a5195a /xmake/actions/install/main.lua
parent218e2711e1afacd334ce50b37b0fa2d2db573e8e (diff)
add --yes to confirm the user input
Diffstat (limited to 'xmake/actions/install/main.lua')
-rw-r--r--xmake/actions/install/main.lua24
1 files changed, 17 insertions, 7 deletions
diff --git a/xmake/actions/install/main.lua b/xmake/actions/install/main.lua
index 15f743c97..8d6ef4db0 100644
--- a/xmake/actions/install/main.lua
+++ b/xmake/actions/install/main.lua
@@ -112,14 +112,24 @@ function main()
-- continue to install with administrator permission?
if sudo.has() then
- -- show tips
- cprint("${bright yellow}note: ${default yellow}try continue to install with administrator permission again?")
- cprint("please input: y (y/n)")
+ -- get confirm
+ local confirm = option.get("yes")
+ if confirm == nil then
- -- get answer
- io.flush()
- local answer = io.read()
- if answer == 'y' or answer == '' then
+ -- show tips
+ cprint("${bright yellow}note: ${default yellow}try continue to install with administrator permission again?")
+ cprint("please input: y (y/n)")
+
+ -- get answer
+ io.flush()
+ local answer = io.read()
+ if answer == 'y' or answer == '' then
+ confirm = true
+ end
+ end
+
+ -- confirm to install?
+ if confirm then
-- install target with administrator permission
sudo.runl(path.join(os.scriptdir(), "install_admin.lua"), {targetname or ifelse(option.get("all"), "__all", "__def"), installdir})