summaryrefslogtreecommitdiff
path: root/xmake/actions/config/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-05-25 22:03:58 +0800
committerruki <[email protected]>2019-05-25 22:03:58 +0800
commit2cae1ff2dc7f1756a8a831cfde5c6610342f978f (patch)
tree397a3b92fd0405dff31e2cb0ea9cd1d02a5c32fe /xmake/actions/config/main.lua
parente2b3965574e574fafbd76d89ee6f5d18ca1265cd (diff)
add confirm option
Diffstat (limited to 'xmake/actions/config/main.lua')
-rw-r--r--xmake/actions/config/main.lua29
1 files changed, 7 insertions, 22 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index 4cafb68ba..dfd6f8e53 100644
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -20,8 +20,8 @@
-- imports
import("core.base.option")
-import("core.project.config")
import("core.base.global")
+import("core.project.config")
import("core.project.project")
import("core.platform.platform")
import("core.project.cache")
@@ -41,7 +41,7 @@ function _option_filter(name)
, root = true
, yes = true
, quiet = true
- , profile = true
+ , confirm = true
, project = true
, verbose = true
, diagnosis = true
@@ -148,28 +148,13 @@ function main()
-- scan project and generate it if xmake.lua not exists
if not os.isfile(project.file()) then
- -- need some tips?
- local autogen = true
- if not option.get("quiet") and not option.get("yes") then
-
- -- show tips
- cprint("${bright color.warning}note: ${clear}xmake.lua not found, try generating it (pass -y to skip confirm)?")
- cprint("please input: n (y/n)")
-
- -- get answer
- io.flush()
- if io.read() ~= 'y' then
- autogen = false
- end
- end
-
- -- do not generate it
- if not autogen then
+ -- scan and generate it automatically
+ local autogen = utils.confirm({default = false, description = "xmake.lua not found, try generating it"})
+ if autogen then
+ scangen()
+ else
os.exit()
end
-
- -- scan and generate it automatically
- scangen()
end
-- enter menu config