1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

🔥 the DiffArguments' wrappers.

This commit is contained in:
Rob Rix 2017-06-16 12:06:27 -04:00
parent e392ac01da
commit 7c5ba48e2f
2 changed files with 5 additions and 18 deletions

View File

@ -18,20 +18,6 @@ data DiffArguments where
deriving instance Show DiffArguments
type DiffArguments' = DiffMode -> DiffArguments
patchDiff :: DiffArguments'
patchDiff = DiffArguments PatchDiffRenderer
jsonDiff :: DiffArguments'
jsonDiff = DiffArguments JSONDiffRenderer
sExpressionDiff :: DiffArguments'
sExpressionDiff = DiffArguments SExpressionDiffRenderer
tocDiff :: DiffArguments'
tocDiff = DiffArguments ToCDiffRenderer
data ParseMode = ParseStdin | ParsePaths [(FilePath, Maybe Language)]
deriving Show

View File

@ -10,6 +10,7 @@ import Data.Version (showVersion)
import Development.GitRev
import Options.Applicative hiding (action)
import Prologue hiding (concurrently, fst, snd, readFile)
import Renderer
import qualified Data.ByteString as B
import qualified Paths_semantic_diff as Library (version)
import qualified Semantic.Task as Task
@ -61,10 +62,10 @@ arguments = info (version <*> helper <*> argumentsParser) description
diffCommand = command "diff" (info diffArgumentsParser (progDesc "Show changes between commits or paths"))
diffArgumentsParser = Diff
<$> ( ( flag patchDiff patchDiff (long "patch" <> help "Output a patch(1)-compatible diff (default)")
<|> flag' jsonDiff (long "json" <> help "Output a json diff")
<|> flag' sExpressionDiff (long "sexpression" <> help "Output an s-expression diff tree")
<|> flag' tocDiff (long "toc" <> help "Output a table of contents for a diff") )
<$> ( ( flag (DiffArguments PatchDiffRenderer) (DiffArguments PatchDiffRenderer) (long "patch" <> help "Output a patch(1)-compatible diff (default)")
<|> flag' (DiffArguments JSONDiffRenderer) (long "json" <> help "Output a json diff")
<|> flag' (DiffArguments SExpressionDiffRenderer) (long "sexpression" <> help "Output an s-expression diff tree")
<|> flag' (DiffArguments ToCDiffRenderer) (long "toc" <> help "Output a table of contents for a diff") )
<*> ( DiffPaths
<$> argument filePathReader (metavar "FILE_A")
<*> argument filePathReader (metavar "FILE_B")