Fix add-handler putting two routes on one line
* If there is a new line at the end of the file, add the route as normal * If there isn't, add a newline character before the route * Closes #921
This commit is contained in:
parent
5d431fbdb5
commit
54cd923ed5
@ -83,17 +83,19 @@ fixCabal name =
|
||||
(spaces, x') = span isSpace x
|
||||
|
||||
fixRoutes :: String -> String -> String -> String -> String
|
||||
fixRoutes name pattern methods =
|
||||
(++ l)
|
||||
fixRoutes name pattern methods fileContents =
|
||||
fileContents ++ l
|
||||
where
|
||||
l = concat
|
||||
[ pattern
|
||||
[ startingCharacter
|
||||
, pattern
|
||||
, " "
|
||||
, name
|
||||
, "R "
|
||||
, methods
|
||||
, "\n"
|
||||
]
|
||||
startingCharacter = if "\n" `isSuffixOf` fileContents then "" else "\n"
|
||||
|
||||
mkHandler :: String -> String -> String -> String
|
||||
mkHandler name pattern methods = unlines
|
||||
|
||||
Loading…
Reference in New Issue
Block a user