summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-01-18 00:43:56 +0800
committerruki <[email protected]>2020-01-17 22:23:37 +0800
commit53e02244ef227a835f435bbfdbecab39be880278 (patch)
tree64becc7d72e9a8ec7e1cf930d51ba39798353b01
parenta859e101ee88ec25fd948a08d2a02e7621241e7f (diff)
fix some code styles
-rw-r--r--xmake/core/base/bytes.lua1
-rw-r--r--xmake/core/base/cli.lua1
-rw-r--r--xmake/core/base/option.lua29
-rw-r--r--xmake/core/base/text.lua2
4 files changed, 8 insertions, 25 deletions
diff --git a/xmake/core/base/bytes.lua b/xmake/core/base/bytes.lua
index 9b32b0de4..54343a962 100644
--- a/xmake/core/base/bytes.lua
+++ b/xmake/core/base/bytes.lua
@@ -289,7 +289,6 @@ function _instance:dump()
end
line = line .. "${clear}"
-
-- dump line
utils.cprint(line)
diff --git a/xmake/core/base/cli.lua b/xmake/core/base/cli.lua
index ea328c22e..5ae476ee1 100644
--- a/xmake/core/base/cli.lua
+++ b/xmake/core/base/cli.lua
@@ -118,5 +118,6 @@ function cli.parsev(argv, flags)
end
cli._segment = segment
+
-- return module
return cli
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua
index c16b400e8..36bcf6c39 100644
--- a/xmake/core/base/option.lua
+++ b/xmake/core/base/option.lua
@@ -97,7 +97,6 @@ end
-- the command line
function option.cmdline()
-
if not xmake._ARGS then
xmake._ARGS = os.args(xmake._ARGV)
end
@@ -127,24 +126,17 @@ function option.init(menu)
-- check command
if xmake._COMMAND then
- -- find the current task
+ -- find the current task and save it
for taskname, taskinfo in pairs(main.tasks) do
-
- -- ok?
if taskname == xmake._COMMAND or taskinfo.shortname == xmake._COMMAND then
- -- save this task
context.taskname = taskname
break
end
end
- -- not found?
+ -- not found?
if not context.taskname or not menu[context.taskname] then
-
- -- print the main menu
option.show_main()
-
- -- invalid task
return false, "invalid task: " .. xmake._COMMAND
end
end
@@ -180,13 +172,9 @@ function option.parse(argv, options, opt)
local flags = {}
for _, o in ipairs(options) do
- -- the mode
+ -- get mode and name
local mode = o[3]
-
- -- the name
local name = o[2]
-
- -- check
assert(o and ((mode ~= "v" and mode ~= "vs") or name))
-- fill short flags
@@ -230,10 +218,8 @@ function option.parse(argv, options, opt)
local match_opt = nil
for _, o in ipairs(options) do
- -- the mode
+ -- get mode and name
local mode = o[3]
-
- -- the name
local name = o[2]
-- is value and with name?
@@ -250,10 +236,8 @@ function option.parse(argv, options, opt)
-- ok? save this value with name opt[2]
if match_opt then
- -- the mode
+ -- get mode and name
local mode = match_opt[3]
-
- -- the name
local name = match_opt[2]
-- save value
@@ -713,9 +697,8 @@ function option.show_options(options, taskname)
end
end
- local tablecontent = {}
-
-- print header
+ local tablecontent = {}
table.insert(tablecontent, {})
if is_action then
table.insert(tablecontent, {{"Common options:", style="${reset bright}"}})
diff --git a/xmake/core/base/text.lua b/xmake/core/base/text.lua
index 0583ce7c4..dad69fc86 100644
--- a/xmake/core/base/text.lua
+++ b/xmake/core/base/text.lua
@@ -154,7 +154,7 @@ end
-- sep = "${dim} | ", -- table colunm sepertor, default is " | ", use "" to hide
-- }
-- priority of style and align: cell > row > col
--- @param opt options for color rendering and word warpping
+-- @param opt options for color rendering and word wrapping
function text.table(data, opt)
assert(data)