Skip to content

Commit bbab0f1

Browse files
committed
fix: port_forward regexp
1 parent 143af86 commit bbab0f1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lua/kubectl/views/definition.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ function M.getPFData(port_forwards, async, kind)
2626
local resource, port, ns
2727
ns = line:match("%-n%s+(%S+)")
2828
if kind == "pods" then
29-
resource, port = line:match("pods/([^%s]+)%s+(%d+:%d+)$")
29+
resource = line:match("pods/([^%s]+)%s+")
30+
port = line:match("(%d+:%d+)")
3031
elseif kind == "svc" then
31-
resource, port = line:match("svc/([^%s]+)%s+(%d+:%d+)$")
32+
resource = line:match("svc/([^%s]+)%s+")
33+
port = line:match("(%d+:%d+)")
3234
elseif kind == "all" then
33-
resource, port = line:match("/([^%s]+)%s+(%d+:%d+)$")
35+
resource = line:match("/([^%s]+)%s+")
36+
port = line:match("(%d+:%d+)")
3437
end
3538

3639
if resource and port then

lua/kubectl/views/pods/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ function M.PortForward(pod, ns)
164164
table.insert(builder.data, " ")
165165

166166
local data = {
167+
{ text = "address:", value = "localhost", cmd = "--address", type = "option" },
167168
{ text = "local:", value = tostring(containers[1].port.value), cmd = "", type = "positional" },
168169
{ text = "container port:", value = tostring(containers[1].port.value), cmd = ":", type = "merge_above" },
169-
{ text = "address:", value = "localhost", cmd = "--address", type = "option" },
170170
}
171171

172172
builder:action_view(pf_def, data, function(args)

0 commit comments

Comments
 (0)