From 51f83d7c03aa099216b464e626e6049779fd24bd Mon Sep 17 00:00:00 2001 From: Leonardo Taglialegne Date: Fri, 12 Apr 2024 06:53:24 +0200 Subject: [PATCH] Fix post-generation message order --- src/Cli.elm | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/Cli.elm b/src/Cli.elm index 8b54fb4..07ffda9 100644 --- a/src/Cli.elm +++ b/src/Cli.elm @@ -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