aboutsummaryrefslogtreecommitdiffstats
path: root/app/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs24
1 files changed, 10 insertions, 14 deletions
diff --git a/app/Main.hs b/app/Main.hs
index a28f4a6..634e085 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -1,5 +1,5 @@
-- TODO Compute history from the top
--- _
+--
-- Currently we are computing the history from the bottom (ie. earliest commit
-- first). When computing history from the top, it might allow us to interrupt
-- the process and present slightly inaccurate information earlier.
@@ -343,7 +343,6 @@ import Options.Applicative qualified as O
import Process (proc, sh_, textInput)
import Render ((<<<))
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
@@ -432,7 +431,7 @@ data Command
| Review
{ baseBranch :: T.Text,
featureBranch :: T.Text,
- granularity :: R.Granularity
+ perCommit :: Bool
}
| Search
{ pattern :: R.RE,
@@ -499,7 +498,7 @@ reviewCmd =
Review
<$> baseBranchArg
<*> featureBranchArg
- <*> granularityArg
+ <*> perCommitArg
baseBranchArg :: O.Parser T.Text
baseBranchArg =
@@ -514,14 +513,11 @@ featureBranchArg :: O.Parser T.Text
featureBranchArg =
O.strArgument (O.metavar "BRANCH_NAME" <> O.value "HEAD")
-granularityArg :: O.Parser R.Granularity
-granularityArg =
- O.option
- O.auto
- ( O.long "granularity"
- <> O.metavar "GRANULARITY"
- <> O.help "Granularity of the review. One of `as-one`, `per-commit`, `per-file` or `per-hunk`. Default: `as-one`."
- <> O.value R.AsOne
+perCommitArg :: O.Parser Bool
+perCommitArg =
+ O.switch
+ ( O.long "per-commit"
+ <> O.help "Review commits individually. (Default: review combined patches)"
)
showCmd :: O.Parser Command
@@ -599,13 +595,13 @@ main = do
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, granularity}} -> do
+ Options {colorize, noPager, width, 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)
- granularity
+ perCommit
baseBranch
featureBranch
".anissue/status"