@@ -36,6 +36,7 @@ import Data.Traversable
36
36
import qualified Database.PostgreSQL.Simple.Options as Client
37
37
import GHC.Generics (Generic )
38
38
import Network.Socket.Free (getFreePort )
39
+ import Prettyprinter
39
40
import System.Directory
40
41
import System.Environment
41
42
import System.Exit (ExitCode (.. ))
@@ -44,7 +45,6 @@ import System.IO.Error
44
45
import System.IO.Temp (createTempDirectory )
45
46
import System.IO.Unsafe (unsafePerformIO )
46
47
import System.Process
47
- import Text.PrettyPrint.ANSI.Leijen hiding ((<$>) )
48
48
import Control.Applicative
49
49
50
50
{-|
@@ -90,7 +90,7 @@ getAccum = \case
90
90
instance Monoid a => Monoid (Accum a ) where
91
91
mempty = DontCare
92
92
93
- prettyMap :: (Pretty a , Pretty b ) => Map a b -> Doc
93
+ prettyMap :: (Pretty a , Pretty b ) => Map a b -> Doc ann
94
94
prettyMap theMap =
95
95
let xs = Map. toList theMap
96
96
in vsep $ map (uncurry prettyKeyPair) xs
@@ -119,10 +119,10 @@ instance Monoid EnvironmentVariables where
119
119
120
120
instance Pretty EnvironmentVariables where
121
121
pretty EnvironmentVariables {.. }
122
- = text " inherit:"
122
+ = " inherit:"
123
123
<+> pretty (getLast inherit)
124
124
<> hardline
125
- <> text " specific:"
125
+ <> " specific:"
126
126
<> softline
127
127
<> indent 2 (prettyMap specific)
128
128
@@ -168,15 +168,15 @@ instance Semigroup CommandLineArgs where
168
168
169
169
instance Pretty CommandLineArgs where
170
170
pretty p@ CommandLineArgs {.. }
171
- = text " keyBased:"
171
+ = " keyBased:"
172
172
<> softline
173
173
<> indent 2 (prettyMap keyBased)
174
174
<> hardline
175
- <> text " indexBased:"
175
+ <> " indexBased:"
176
176
<> softline
177
177
<> indent 2 (prettyMap indexBased)
178
178
<> hardline
179
- <> text " completed:" <+> text (unwords (completeCommandLineArgs p))
179
+ <> " completed:" <+> pretty (unwords (completeCommandLineArgs p))
180
180
181
181
-- Take values as long as the index is the successor of the
182
182
-- last index.
@@ -222,24 +222,24 @@ data ProcessConfig = ProcessConfig
222
222
223
223
instance Pretty ProcessConfig where
224
224
pretty ProcessConfig {.. }
225
- = text " environmentVariables:"
225
+ = " environmentVariables:"
226
226
<> softline
227
227
<> indent 2 (pretty environmentVariables)
228
228
<> hardline
229
- <> text " commandLine:"
229
+ <> " commandLine:"
230
230
<> softline
231
231
<> indent 2 (pretty environmentVariables)
232
232
<> hardline
233
- <> text " stdIn:" <+>
234
- pretty ( prettyHandle <$> getLast stdIn)
233
+ <> " stdIn:" <+>
234
+ maybe mempty prettyHandle ( getLast stdIn)
235
235
<> hardline
236
- <> text " stdOut:" <+>
237
- pretty ( prettyHandle <$> getLast stdOut)
236
+ <> " stdOut:" <+>
237
+ maybe mempty prettyHandle ( getLast stdOut)
238
238
<> hardline
239
- <> text " stdErr:" <+>
240
- pretty ( prettyHandle <$> getLast stdErr)
239
+ <> " stdErr:" <+>
240
+ maybe mempty prettyHandle ( getLast stdErr)
241
241
<> hardline
242
- <> text " createGroup:" <+>
242
+ <> " createGroup:" <+>
243
243
pretty (getAny createGroup)
244
244
245
245
@@ -327,8 +327,8 @@ toFilePath = \case
327
327
328
328
instance Pretty CompleteDirectoryType where
329
329
pretty = \ case
330
- CPermanent x -> text " CPermanent" <+> pretty x
331
- CTemporary x -> text " CTemporary" <+> pretty x
330
+ CPermanent x -> " CPermanent" <+> pretty x
331
+ CTemporary x -> " CTemporary" <+> pretty x
332
332
333
333
makePermanent :: CompleteDirectoryType -> CompleteDirectoryType
334
334
makePermanent = \ case
@@ -349,8 +349,8 @@ data DirectoryType
349
349
350
350
instance Pretty DirectoryType where
351
351
pretty = \ case
352
- Permanent x -> text " Permanent" <+> pretty x
353
- Temporary -> text " Temporary"
352
+ Permanent x -> " Permanent" <+> pretty x
353
+ Temporary -> " Temporary"
354
354
355
355
-- | Takes the last 'Permanent' value.
356
356
instance Semigroup DirectoryType where
@@ -546,46 +546,46 @@ data Config = Config
546
546
547
547
instance Pretty Config where
548
548
pretty Config {.. }
549
- = text " socketDirectory:"
549
+ = " socketDirectory:"
550
550
<> softline
551
551
<> pretty socketDirectory
552
552
<> hardline
553
- <> text " dataDirectory:"
553
+ <> " dataDirectory:"
554
554
<> softline
555
555
<> pretty dataDirectory
556
556
<> hardline
557
- <> text " port:" <+> pretty (getLast port)
557
+ <> " port:" <+> pretty (getLast port)
558
558
<> hardline
559
- <> text " temporaryDirectory:"
559
+ <> " temporaryDirectory:"
560
560
<> softline
561
561
<> pretty (getLast temporaryDirectory)
562
562
<> hardline
563
- <> text " initDbCache:" <+> pretty (getLast initDbCache)
563
+ <> " initDbCache:" <+> pretty (getLast initDbCache)
564
564
<> hardline
565
- <> text " initDbConfig:"
565
+ <> " initDbConfig:"
566
566
<> softline
567
567
<> indent 2 (pretty $ getAccum initDbConfig)
568
568
<> hardline
569
- <> text " initDbConfig:"
569
+ <> " initDbConfig:"
570
570
<> softline
571
571
<> indent 2 (pretty $ getAccum createDbConfig)
572
- <> text " copyConfig:"
572
+ <> " copyConfig:"
573
573
<> softline
574
574
<> indent 2 (pretty (getLast copyConfig))
575
575
<> hardline
576
- <> text " postgresConfig:"
576
+ <> " postgresConfig:"
577
577
<> softline
578
578
<> indent 2 (pretty postgresConfig)
579
579
<> hardline
580
- <> text " connectionOptions:"
580
+ <> " connectionOptions:"
581
581
<> softline
582
582
<> indent 2 (prettyOptions connectionOptions)
583
583
<> hardline
584
- <> text " postgresConfigFile:"
584
+ <> " postgresConfigFile:"
585
585
<> softline
586
- <> indent 2 (vsep $ map (\ (x, y) -> text x <> " =" <> text y) postgresConfigFile)
586
+ <> indent 2 (vsep $ map (\ (x, y) -> pretty x <> " =" <> pretty y) postgresConfigFile)
587
587
<> hardline
588
- <> text " connectionTimeout:" <+> pretty (getLast connectionTimeout)
588
+ <> " connectionTimeout:" <+> pretty (getLast connectionTimeout)
589
589
590
590
socketDirectoryToConfig :: FilePath -> [(String , String )]
591
591
socketDirectoryToConfig dir =
@@ -613,15 +613,15 @@ data CopyDirectoryCommand = CopyDirectoryCommand
613
613
614
614
instance Pretty CopyDirectoryCommand where
615
615
pretty CopyDirectoryCommand {.. }
616
- = text " sourceDirectory:"
616
+ = " sourceDirectory:"
617
617
<> softline
618
- <> indent 2 (text sourceDirectory)
618
+ <> indent 2 (pretty sourceDirectory)
619
619
<> hardline
620
- <> text " destinationDirectory:"
620
+ <> " destinationDirectory:"
621
621
<> softline
622
622
<> indent 2 (pretty destinationDirectory)
623
623
<> hardline
624
- <> text " useCopyOnWrite:"
624
+ <> " useCopyOnWrite:"
625
625
<+> pretty useCopyOnWrite
626
626
627
627
completeCopyDirectory
@@ -847,14 +847,14 @@ data Resources = Resources
847
847
848
848
instance Pretty Resources where
849
849
pretty Resources {.. }
850
- = text " resourcePlan:"
850
+ = " resourcePlan:"
851
851
<> softline
852
852
<> indent 2 (pretty resourcesPlan)
853
853
<> hardline
854
- <> text " resourcesSocket:"
854
+ <> " resourcesSocket:"
855
855
<+> pretty resourcesSocketDirectory
856
856
<> hardline
857
- <> text " resourcesDataDir:"
857
+ <> " resourcesDataDir:"
858
858
<+> pretty resourcesDataDir
859
859
860
860
-- | Make the 'resourcesDataDir' 'CPermanent' so it will not
0 commit comments