diff options
Diffstat (limited to 'app/Main.hs')
-rw-r--r-- | app/Main.hs | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/app/Main.hs b/app/Main.hs index 634e085..0154840 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -322,6 +322,7 @@ import Control.Applicative ((<|>)) import Control.Exception (catch) import Data.Function ((&)) import Data.List (find, intersperse) +import Data.List.NonEmpty qualified as NE import Data.Map qualified as M import Data.Maybe (fromMaybe) import Data.Text qualified as T @@ -340,11 +341,12 @@ import Issue.Render () import Issue.Sort qualified as I import Options.Applicative ((<**>)) import Options.Applicative qualified as O +import Patch qualified as A import Process (proc, sh_, textInput) -import Render ((<<<)) +import Render (renderAsText, (<<<)) import Render qualified as P +import Review qualified as R import Settings (Settings (..), readSettings) -import Status qualified as S import System.Console.Terminal.Size qualified as Terminal import System.Exit (ExitCode (ExitFailure), exitWith) import System.FilePath ((</>)) @@ -427,7 +429,6 @@ data Command | Open { id :: String } - | Status | Review { baseBranch :: T.Text, featureBranch :: T.Text, @@ -459,8 +460,6 @@ cmd = O.progDesc "List issues matching a pattern", O.command "show" . O.info showCmd $ O.progDesc "Show details of all issues", - O.command "status" . O.info statusCmd $ - O.progDesc "Describe the current anissue action.", O.command "tags" . O.info tagsCmd $ O.progDesc "Show all tags" ] @@ -532,10 +531,6 @@ patternArg = (O.maybeReader R.compileRegex) (O.metavar "PATTERN") -statusCmd :: O.Parser Command -statusCmd = - pure Status - tagsCmd :: O.Parser Command tagsCmd = pure Tags @@ -592,21 +587,24 @@ main :: IO () main = do settings <- readSettings O.execParser (O.info (options <**> O.helper) O.idm) >>= \case - Options {colorize, noPager, width, command = Status} -> do - status <- S.readStatus ".anissue/status" - putDoc colorize noPager width status - Options {colorize, noPager, width, command = Review {baseBranch, featureBranch, perCommit}} -> do + Options {command = Review {baseBranch, featureBranch, perCommit}} -> do sh_ "test -z $(git status --porcelain --untracked-files=no)" `catch` \(_ :: E.ProcessException) -> error "working directory not clean, aborting.." - S.withReviewing - (putDoc colorize noPager width) - perCommit - baseBranch - featureBranch - ".anissue/status" - S.continueReview --- REVIEW Why is withReviewing in the Status module and not the Review module? + plan <- R.formulatePlan perCommit baseBranch featureBranch + patch <- + A.Patch . concat + <$> mapM + ( \step -> do + R.separateReview step.commit step.changes + =<< R.reviewPatch step.changes + ) + (NE.toList plan.steps) + T.writeFile "review.patch" (renderAsText patch) + -- REVIEW Why is withReviewing in the Status module and not the Review + -- module? + -- + -- RESOLVED `Status` has been dropped in this commit Options {colorize, noPager, width, command = List {sort, filters, files, group = Just group, closed}} -> do ungroupedIssues <- I.applySorts sort |