Skip to content

Commit

Permalink
Fix post-generation message order
Browse files Browse the repository at this point in the history
  • Loading branch information
miniBill committed Apr 12, 2024
1 parent cae6a71 commit 51f83d7
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions src/Cli.elm
Original file line number Diff line number Diff line change
Expand Up @@ -201,23 +201,33 @@ generateFileFromOpenApiSpec config apiSpec =
padLeftBy4Spaces =
String.padLeft 4 ' '
in
BackendTask.combine
[ Pages.Script.log <| "SDK generated at " ++ outputPath
, Pages.Script.log ""
, Pages.Script.log ""
, Pages.Script.log "You'll need elm/http, elm/json and elm-community/json-extra installed. Try running:"
, Pages.Script.log ""
, Pages.Script.log ""
, Pages.Script.log <| padLeftBy4Spaces "elm install elm/http"
, Pages.Script.log ""
, Pages.Script.log <| padLeftBy4Spaces "elm install elm/json"
, Pages.Script.log ""
, Pages.Script.log <| padLeftBy4Spaces "elm install elm-community/json-extra"
]
|> BackendTask.map (always ())
[ "SDK generated at " ++ outputPath
, ""
, ""
, "You'll need elm/http, elm/json and elm-community/json-extra installed. Try running:"
, ""
, ""
, padLeftBy4Spaces "elm install elm/http"
, ""
, padLeftBy4Spaces "elm install elm/json"
, ""
, padLeftBy4Spaces "elm install elm-community/json-extra"
]
|> List.map Pages.Script.log
|> doAll
)


doAll : List (BackendTask.BackendTask error ()) -> BackendTask.BackendTask error ()
doAll list =
case list of
[] ->
BackendTask.succeed ()

head :: tail ->
head |> BackendTask.andThen (\_ -> doAll tail)


messageToString : Message -> String
messageToString { path, message } =
if List.isEmpty path then
Expand Down

0 comments on commit 51f83d7

Please sign in to comment.