Skip to content

Commit 3418717

Browse files
att
1 parent f499b78 commit 3418717

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

src/luargv/base_flags.lua

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,30 +63,14 @@ luargv.get_first_flag_arg = function(flags, default)
6363
if luargv.type(flags) == "string" then
6464
flags = { flags }
6565
end
66-
local total_found = 0
6766
local args_size = luargv.get_total_args_size()
68-
local capturing_flags = false
69-
local possible_flag_index = nil
7067
for i = 1, args_size do
7168
local current = luargv.get_arg_by_index_not_adding_to_used(i)
7269
local possible_flag = private_luargv.get_formmated_flag_if_its_a_flag(current)
7370
if possible_flag then
7471
if private_luargv.is_inside(flags, possible_flag) then
75-
possible_flag_index = i
76-
capturing_flags = true
77-
else
78-
capturing_flags = false
79-
end
80-
end
81-
82-
if capturing_flags and not possible_flag then
83-
total_found = total_found + 1
84-
if total_found == index then
85-
if possible_flag_index then
86-
luargv.add_used_args_by_index(possible_flag_index)
87-
end
8872
luargv.add_used_args_by_index(i)
89-
return current
73+
return luargv.get_arg_by_index(i + 1)
9074
end
9175
end
9276
end

src/luargv/used_flags.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ luargv.get_next_unused = function()
4242
if i then
4343
return luargv.get_arg_by_index(i)
4444
end
45+
return nil
4546
end

0 commit comments

Comments
 (0)