Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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