aboutsummaryrefslogtreecommitdiff
path: root/Opts.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2025-07-13 10:24:23 +0200
committerMirek Kratochvil <exa.exa@gmail.com>2025-07-13 10:24:23 +0200
commitbc5d7a6915af2774f17f31641ed249d20311f9ee (patch)
treee0615bfd375c20ba3bf4eaa436a216aeb8eb3722 /Opts.hs
parent96a623ac0766df9d6427419c1c8a8e799798d825 (diff)
downloadwerge-bc5d7a6915af2774f17f31641ed249d20311f9ee.tar.gz
werge-bc5d7a6915af2774f17f31641ed249d20311f9ee.tar.bz2
fine-grained space merging
Diffstat (limited to 'Opts.hs')
-rw-r--r--Opts.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/Opts.hs b/Opts.hs
index bc76360..7b6f7d4 100644
--- a/Opts.hs
+++ b/Opts.hs
@@ -38,13 +38,15 @@ tokenizer =
]
data Spaces
- = SpacesConflict
+ = SpacesNormal
+ | SpacesConflict
| SpacesMy
| SpacesOld
| SpacesYour
- deriving (Show)
+ deriving (Show, Eq)
spaceMode x
+ | x `isPrefixOf` "normal" = Right SpacesNormal
| x `isPrefixOf` "conflict" = Right SpacesConflict
| x `isPrefixOf` "my" = Right SpacesMy
| x `isPrefixOf` "old" = Right SpacesOld
@@ -53,7 +55,7 @@ spaceMode x
Left
$ "could not parse value `"
++ x
- ++ "', use one of `conflict', `my', `old', and `your'"
+ ++ "', use one of `normal', `conflict', `my', `old', and `your'"
data Config = Config
{ cfgTokenizer :: Tokenizer
@@ -75,10 +77,10 @@ config = do
option (eitherReader spaceMode)
$ long "spaces"
<> short 's'
- <> metavar "(conflict|my|old|your)"
+ <> metavar "(normal|conflict|my|old|your)"
<> help
- "mode of merging the spaces; instead of conflict one may choose to default the space from the source files (default: conflict)"
- <> value SpacesConflict
+ "mode of merging the space-only changes; instead of usual resolution one may choose to always conflict or to default the space from the source files (default: normal)"
+ <> value SpacesNormal
cfgContext <-
option auto
$ long "expand-context"