diff options
| author | Opportunity <[email protected]> | 2020-01-16 17:25:48 +0800 |
|---|---|---|
| committer | Opportunity <[email protected]> | 2020-01-16 17:25:48 +0800 |
| commit | 9cca6d065a6d8756876f6877725eeaa1304a6ef7 (patch) | |
| tree | 888a589d7099b0d383b036c0fdba77189a50fdc6 /xmake/core/base/cli.lua | |
| parent | d5f108398a0b638f60aaab8089831bb9e67023c4 (diff) | |
fix style
Diffstat (limited to 'xmake/core/base/cli.lua')
| -rw-r--r-- | xmake/core/base/cli.lua | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/xmake/core/base/cli.lua b/xmake/core/base/cli.lua index 310335fd4..ea328c22e 100644 --- a/xmake/core/base/cli.lua +++ b/xmake/core/base/cli.lua @@ -49,15 +49,15 @@ function cli._make_segment(type, string, argv, argi, obj) end function cli._make_arg(value, argv, argi) - return cli._make_segment('arg', value, argv, argi, { value = value }) + return cli._make_segment("arg", value, argv, argi, { value = value }) end function cli._make_flag(key, short, argv, argi) - return cli._make_segment('flag', short and ('-' .. key) or ('--' .. key), argv, argi, { key = key, value = true, short = short or false }) + return cli._make_segment("flag", short and ("-" .. key) or ("--" .. key), argv, argi, { key = key, value = true, short = short or false }) end function cli._make_option(key, value, short, argv, argi) - return cli._make_segment('option', short and ('-' .. key .. ' ' .. value) or ('--' .. key .. '=' .. value), argv, argi, { key = key, value = value, short = short or false }) + return cli._make_segment("option", short and ("-" .. key .. " " .. value) or ("--" .. key .. "=" .. value), argv, argi, { key = key, value = value, short = short or false }) end function cli.parse(args, ...) @@ -74,17 +74,17 @@ function cli.parsev(argv, flags) while index <= #argv do value = argv[index] - if raw or not value:startswith('-') or #value < 2 then - -- all args after '--' or first arg, args don't start with '-', and short args (include a single char '-') + if raw or not value:startswith("-") or #value < 2 then + -- all args after "--" or first arg, args don"t start with "-", and short args (include a single char "-") raw = true table.insert(parsed, cli._make_arg(value, argv, index)) - elseif value == '--' then - -- stop parsing after '--' + elseif value == "--" then + -- stop parsing after "--" raw = true - table.insert(parsed, cli._make_segment('sep', '--', argv, index, {})) - elseif value:startswith('--') then - -- '--key:value', '--key=value', '--long-flag' - local sep = value:find('[=:]', 3, false) + table.insert(parsed, cli._make_segment("sep", "--", argv, index, {})) + elseif value:startswith("--") then + -- "--key:value", "--key=value", "--long-flag" + local sep = value:find("[=:]", 3, false) if sep then table.insert(parsed, cli._make_option(value:sub(3, sep - 1), value:sub(sep + 1), false, argv, index)) else |
