pass original branch to gpm command handlers
This commit is contained in:
parent
ee7fe89d12
commit
f52312b731
3 changed files with 15 additions and 15 deletions
|
@ -34,8 +34,8 @@ getGitUser = debug "git config user.name"
|
|||
|
||||
-- | Ensure actions occurs in the @gpm@ branch
|
||||
-- and returns to current branch with also all untracked files
|
||||
inGPM :: IO a -> IO a
|
||||
inGPM actions = bracket safeChangeBranch safeReturnBranch (const actions)
|
||||
inGPM :: (Text -> IO a) -> IO a
|
||||
inGPM = bracket safeChangeBranch safeReturnBranch
|
||||
where
|
||||
safeChangeBranch = do
|
||||
res <- getCurrentGitBranch
|
||||
|
|
|
@ -112,9 +112,9 @@ createTmpNewIssue ni = do
|
|||
die "Parse ERROR, check your template ./templates/new-issue.org"
|
||||
Right compiled -> writeFile ".issues.org.tmp" (substitute compiled ni)
|
||||
|
||||
handleNewIssue :: IssueOptions -> IO ()
|
||||
handleNewIssue opts = do
|
||||
newIssueTmp <- gatherNewIssueInfos (newIssue opts)
|
||||
handleNewIssue :: IssueOptions -> Text -> IO ()
|
||||
handleNewIssue opts br = do
|
||||
newIssueTmp <- gatherNewIssueInfos (newIssue opts) br
|
||||
newIssue <- if interactive opts
|
||||
then interactiveNewIssue newIssueTmp
|
||||
else return newIssueTmp
|
||||
|
@ -158,13 +158,13 @@ validTmpNewIssue = do
|
|||
tmpIssue <- readFile ".issues.org.tmp"
|
||||
appendFile "issues.org" ("\n\n" <> tmpIssue)
|
||||
|
||||
gatherNewIssueInfos :: NewIssue -> IO NewIssue
|
||||
gatherNewIssueInfos iss = do
|
||||
gatherNewIssueInfos :: NewIssue -> Text -> IO NewIssue
|
||||
gatherNewIssueInfos iss br = do
|
||||
user <- if isNothing (user iss)
|
||||
then getGitUser
|
||||
else return (user iss)
|
||||
branch <- if isNothing (branch iss)
|
||||
then getCurrentGitBranch
|
||||
then return (Just br)
|
||||
else return (branch iss)
|
||||
return $ iss { user = user
|
||||
, branch = branch }
|
||||
|
|
|
@ -47,10 +47,10 @@ parseReviewCmd =
|
|||
<|> subcommand "question" "Ask a question" (pure ReviewQuestion)
|
||||
<|> subcommand "reject" "Reject the merge" (pure ReviewReject)
|
||||
|
||||
handleReview :: ReviewCommand -> IO ()
|
||||
handleReview (ReviewStart _br) = die "TODO"
|
||||
handleReview (ReviewStop _br ) = die "TODO"
|
||||
handleReview ReviewAccept = die "TODO"
|
||||
handleReview ReviewFeedback = die "TODO"
|
||||
handleReview ReviewQuestion = die "TODO"
|
||||
handleReview ReviewReject = die "TODO"
|
||||
handleReview :: ReviewCommand -> Text -> IO ()
|
||||
handleReview (ReviewStart _br) _ = die "TODO"
|
||||
handleReview (ReviewStop _br ) _ = die "TODO"
|
||||
handleReview ReviewAccept _ = die "TODO"
|
||||
handleReview ReviewFeedback _ = die "TODO"
|
||||
handleReview ReviewQuestion _ = die "TODO"
|
||||
handleReview ReviewReject _ = die "TODO"
|
||||
|
|
Loading…
Reference in a new issue