Skip to content

Commit

Permalink
Octo pr checkout uses picker when not in Octo buffer (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
wd60622 authored Jan 29, 2025
1 parent d66d886 commit 5b71799
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/octo/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ function M.setup()
local bufnr = vim.api.nvim_get_current_buf()
local buffer = octo_buffers[bufnr]
if not buffer or not buffer:isPullRequest() then
picker.prs {
cb = function(selected)
utils.checkout_pr(selected.obj.number)
end,
}
return
end
if not utils.in_pr_repo() then
Expand Down
10 changes: 10 additions & 0 deletions lua/octo/pickers/fzf-lua/pickers/prs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@ local function checkout_pull_request(entry)
utils.checkout_pr(entry.obj.number)
end

local function not_implemented()
utils.error "Not implemented yet"
end

return function(opts)
opts = opts or {}
if not opts.states then
opts.states = "OPEN"
end

if opts.cb ~= nil then
not_implemented()
return
end

local filter = picker_utils.get_filter(opts, "pull_request")
if utils.is_blank(opts.repo) then
opts.repo = utils.get_remote_name()
Expand Down

0 comments on commit 5b71799

Please sign in to comment.