Skip to content

Commit

Permalink
Adjust the initial comment in cabal files generated by cabal init
Browse files Browse the repository at this point in the history
Use slightly longer lines and a somewhat more terse comment.
Also use a new shorter and hopefully stable URL for the user guide.
  • Loading branch information
dcoutts committed May 17, 2011
1 parent dc186a8 commit a1da3d7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cabal-install/Distribution/Client/Init.hs
Expand Up @@ -419,9 +419,13 @@ writeCabalFile flags@(InitFlags{packageName = Flag p}) = do
-- structure onto a low-level AST structure and use the existing
-- pretty-printing code to generate the file.
generateCabalFile :: String -> InitFlags -> String
generateCabalFile fileName c = render $
generateCabalFile fileName c =
renderStyle style { lineLength = 79, ribbonsPerLine = 1.1 } $
(if (minimal c /= Flag True)
then showComment (Just $ fileName ++ " auto-generated by cabal init. For additional options, see http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.")
then showComment (Just $ "Initial " ++ fileName ++ " generated by cabal "
++ "init. For further documentation, see "
++ "http://haskell.org/cabal/users-guide/")
$$ text ""
else empty)
$$
vcat [ fieldS "name" (packageName c)
Expand Down Expand Up @@ -552,7 +556,11 @@ generateCabalFile fileName c = render $
showComment :: Maybe String -> Doc
showComment (Just t) = vcat . map text
. map ("-- "++) . lines
. render . fsep . map text . words $ t
. renderStyle style {
lineLength = 76,
ribbonsPerLine = 1.05
}
. fsep . map text . words $ t
showComment Nothing = text ""

-- | Generate warnings for missing fields etc.
Expand Down

0 comments on commit a1da3d7

Please sign in to comment.