Skip to content

Commit

Permalink
refactor to use command syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
wd60622 committed Feb 20, 2025
1 parent a0ddd81 commit 631ab6f
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions lua/octo/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,17 @@ end
---@param milestone_name string milestone name
function M.add_milestone(issue, number, milestone_name)
local command = issue and "issue" or "pr"
local args = { command, "edit", number, "--milestone", milestone_name }

gh.run {
args = args,
cb = function(output, stderr)
if stderr and not M.is_blank(stderr) then
M.error(stderr)
elseif output then
M.info("Added milestone " .. milestone_name)
end
end,
gh[command].edit {
number,
milestone = milestone_name,
opts = {
cb = gh.create_callback {
success = function(_)
M.info("Added milestone " .. milestone_name)
end,
},
},
}
end

Expand All @@ -348,17 +348,17 @@ end
---@param number number issue or PR number
function M.remove_milestone(issue, number)
local command = issue and "issue" or "pr"
local args = { command, "edit", number, "--remove-milestone" }

gh.run {
args = args,
cb = function(output, stderr)
if stderr and not M.is_blank(stderr) then
M.error(stderr)
elseif output then
M.info "Removed milestone"
end
end,
gh[command].edit {
number,
remove_milestone = true,
opts = {
cb = gh.create_callback {
success = function(_)
M.info "Removed milestone"
end,
},
},
}
end

Expand Down

0 comments on commit 631ab6f

Please sign in to comment.