Find git executable at run time
[git-darcs-import.git] / src / Darcs / PrintPatch.lhs
blobd2dbc2075c432fd54c52afe65aee2fe100000595
1 % Copyright (C) 2003 David Roundy
3 % This program is free software; you can redistribute it and/or modify
4 % it under the terms of the GNU General Public License as published by
5 % the Free Software Foundation; either version 2, or (at your option)
6 % any later version.
8 % This program is distributed in the hope that it will be useful,
9 % but WITHOUT ANY WARRANTY; without even the implied warranty of
10 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 % GNU General Public License for more details.
13 % You should have received a copy of the GNU General Public License
14 % along with this program; see the file COPYING. If not, write to
15 % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 % Boston, MA 02110-1301, USA.
19 \begin{code}
20 {-# OPTIONS_GHC -cpp #-}
21 {-# LANGUAGE CPP #-}
23 #include "gadts.h"
25 module Darcs.PrintPatch ( printPatch, contextualPrintPatch,
26 printPatchPager, printFriendly ) where
28 import Darcs.Patch ( Patchy, showContextPatch, showPatch )
29 import Darcs.SlurpDirectory ( Slurpy )
30 import Darcs.Arguments ( DarcsFlag, showFriendly )
31 import Printer ( putDocLnWith )
32 import Darcs.ColorPrinter ( fancyPrinters )
33 import Darcs.External ( viewDocWith )
34 \end{code}
37 \begin{code}
39 -- | @'printFriendly' opts patch@ prints @patch@ in accordance with the
40 -- flags in opts, ie, whether @--verbose@ or @--summary@ were passed at
41 -- the command-line.
42 printFriendly :: Patchy p => [DarcsFlag] -> p C(x y) -> IO ()
43 printFriendly opts p = putDocLnWith fancyPrinters $ showFriendly opts p
45 -- | 'printPatch' prints a patch on standard output.
46 printPatch :: Patchy p => p C(x y) -> IO ()
47 printPatch p = putDocLnWith fancyPrinters $ showPatch p
49 -- | 'printPatchPager' runs '$PAGER' and shows a patch in it.
50 printPatchPager :: Patchy p => p C(x y) -> IO ()
51 printPatchPager p = viewDocWith fancyPrinters $ showPatch p
53 -- | 'contextualPrintPatch' prints a patch, together with its context,
54 -- on standard output.
55 contextualPrintPatch :: Patchy p => Slurpy -> p C(x y) -> IO ()
56 contextualPrintPatch s p = putDocLnWith fancyPrinters $ showContextPatch s p
58 \end{code}