diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-02-29 04:11:10 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-14 07:07:39 +0100 |
commit | f92c593a3d2c4bdb023fdd834b6e8c874d063cc8 (patch) | |
tree | b506bb61f4951207aa1aff04080fd3d7874927c3 /diff-parse.patch | |
parent | 941f0d4ccb688d42c0438e05051ed78a410431b6 (diff) |
feat: add `review` command
Prototype of the `review` command, cf. `anissue review -h`. Also adds
the `status` command.
Diffstat (limited to 'diff-parse.patch')
-rw-r--r-- | diff-parse.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/diff-parse.patch b/diff-parse.patch new file mode 100644 index 0000000..d3fac03 --- /dev/null +++ b/diff-parse.patch @@ -0,0 +1,39 @@ +diff --git a/src/Text/Diff/Parse/Internal.hs b/src/Text/Diff/Parse/Internal.hs +index 99302b8..715686c 100644 +--- a/src/Text/Diff/Parse/Internal.hs ++++ b/src/Text/Diff/Parse/Internal.hs +@@ -50,12 +50,12 @@ fileDelta = do + fileDeltaHeader :: Parser (FileStatus, Text, Text) + fileDeltaHeader = do + _ <- string "diff --git " +- source <- path <* space +- dest <- path <* endOfLine ++ _ <- path <* space ++ _ <- path <* endOfLine + status <- fileStatus + _ <- option "" (string "index" >> takeLine) +- _ <- option "" (string "--- " >> takeLine) +- _ <- option "" (string "+++ " >> takeLine) ++ source <- string "--- " >> path <* endOfLine ++ dest <- string "+++ " >> path <* endOfLine + return $ (status, source, dest) + + takeLine :: Parser Text +@@ -97,3 +97,4 @@ annotation :: Parser Annotation + annotation = (char '+' >> return Added) + <|> (char '-' >> return Removed) + <|> (char ' ' >> return Context) ++ <|> (char '#' >> return Comment) +diff --git a/src/Text/Diff/Parse/Types.hs b/src/Text/Diff/Parse/Types.hs +index a658ae4..3901575 100644 +--- a/src/Text/Diff/Parse/Types.hs ++++ b/src/Text/Diff/Parse/Types.hs +@@ -2,7 +2,7 @@ module Text.Diff.Parse.Types where + + import Data.Text (Text) + +-data Annotation = Added | Removed | Context deriving (Show, Eq) ++data Annotation = Added | Removed | Context | Comment deriving (Show, Eq) + + data Line = Line { + lineAnnotation :: Annotation |