Skip to content

Commit

Permalink
Merge pull request #62 from qrilka/haddock-fixes
Browse files Browse the repository at this point in the history
Haddock fixes
  • Loading branch information
k-bx committed Mar 24, 2016
2 parents 15da23e + 11ae21f commit 74cc620
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 152 deletions.
9 changes: 8 additions & 1 deletion codegen/GenCmds.hs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ data Cmd = Cmd { cmdName, cmdGroup :: String
, cmdRetType :: Maybe String
, cmdArgs :: [Arg]
, cmdSummary :: String
, cmdSince :: String
}
deriving (Show)

Expand All @@ -123,6 +124,7 @@ instance FromJSON Cmds where
cmdGroup <- cmd .: "group"
cmdRetType <- cmd .:? "returns"
cmdSummary <- cmd .: "summary"
cmdSince <- cmd .: "since"
cmdArgs <- cmd .:? "arguments" .!= []
<|> error ("failed to parse args: " ++ cmdName)
return Cmd{..})
Expand Down Expand Up @@ -253,8 +255,12 @@ exportCmdNames Cmd{..} = types `mappend` functions
Just (Just (_,ts)) -> ts
Just Nothing -> error "unhandled"

dropTrailingDot s = case reverse s of
('.':rest) -> reverse rest
_ -> s

haddock = mconcat
[ fromString "-- |", fromString cmdSummary
[ fromString "-- |", fromString (dropTrailingDot cmdSummary)
, fromString " ("
, cmdDescriptionLink cmdName
, fromString ")."
Expand All @@ -267,6 +273,7 @@ exportCmdNames Cmd{..} = types `mappend` functions
, fromString "'."
]
else mempty
, fromString " Since Redis ", fromString cmdSince
]

cmdDescriptionLink :: String -> Builder
Expand Down
Loading

0 comments on commit 74cc620

Please sign in to comment.