@@ -355,15 +355,18 @@ loadTemplate name logIt = do
355
355
pure template
356
356
else throwM $ PrettyException $
357
357
LoadTemplateFailed name path
358
+
358
359
relSettings :: String -> Maybe TemplateDownloadSettings
359
360
relSettings req = do
360
361
rtp <- parseRepoPathWithService defaultRepoService (T. pack req)
361
362
pure (settingsFromRepoTemplatePath rtp)
363
+
362
364
downloadFromUrl :: TemplateDownloadSettings -> Path Abs Dir -> RIO env Text
363
365
downloadFromUrl settings templateDir = do
364
366
let url = tplDownloadUrl settings
365
367
rel = fromMaybe backupUrlRelPath (parseRelFile url)
366
368
downloadTemplate url (tplExtract settings) (templateDir </> rel)
369
+
367
370
downloadTemplate :: String
368
371
-> (ByteString
369
372
-> Either String Text )
@@ -375,12 +378,15 @@ loadTemplate name logIt = do
375
378
mkDownloadRequest (setRequestCheckStatus req)
376
379
logIt RemoteTemp
377
380
catch
378
- (void $ do
379
- verifiedDownloadWithProgress dReq path (T. pack $ toFilePath path) Nothing
381
+ ( do let label = T. pack $ toFilePath path
382
+ res <- verifiedDownloadWithProgress dReq path label Nothing
383
+ if res
384
+ then logStickyDone (" Downloaded " <> display label <> " ." )
385
+ else logStickyDone " Already downloaded."
380
386
)
381
387
(useCachedVersionOrThrow url path)
382
-
383
388
loadLocalFile path extract
389
+
384
390
useCachedVersionOrThrow :: String
385
391
-> Path Abs File
386
392
-> VerifiedDownloadException
@@ -636,10 +642,16 @@ runTemplateInits dir = do
636
642
config <- view configL
637
643
case configScmInit config of
638
644
Nothing -> pure ()
639
- Just Git ->
640
- withWorkingDir (toFilePath dir) $
641
- catchAny (proc " git" [" init" ] runProcess_)
642
- (\ _ -> logInfo " git init failed to run, ignoring ..." )
645
+ Just Git -> withWorkingDir (toFilePath dir) $
646
+ catchAny
647
+ (proc " git" [" init" ] runProcess_)
648
+ ( \ _ -> prettyWarn $
649
+ fillSep
650
+ [ flow " Stack failed to run a"
651
+ , style Shell (flow " git init" )
652
+ , flow " command. Ignoring..."
653
+ ]
654
+ )
643
655
644
656
-- | Display help for the templates command.
645
657
templatesHelp :: HasLogFunc env => RIO env ()
0 commit comments