Skip to content

Commit

Permalink
Check if target might be a project.
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Jan 18, 2023
1 parent 859ad42 commit bdc2f80
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/Stack/Build/Target.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
Expand Down Expand Up @@ -155,11 +156,26 @@ parseRawTargetDirs root locals ri =
mdir <- liftIO $ forgivingAbsence (resolveDir root (T.unpack t))
>>= rejectMissingDir
case mdir of
Nothing -> pure $ Left $
fillSep
[ flow "Directory not found:"
, style Dir (fromString $ T.unpack t) <> "."
]
Nothing -> pure . Left $
if | T.isPrefixOf "stack-yaml" t ->
fillSep
[ flow "Directory not found:"
, style Dir (fromString $ T.unpack t) <> "."
, flow "Is this a typo? Can I suggest:"
, style Dir (fromString $ "--" ++ T.unpack t)
]
| T.isSuffixOf ".yaml" t ->
fillSep
[ flow "Directory not found:"
, style Dir (fromString $ T.unpack t) <> "."
, flow "Is this a typo? Can I suggest:"
, style Dir (fromString $ "--stack-yaml " ++ T.unpack t)
]
| otherwise ->
fillSep
[ flow "Directory not found:"
, style Dir (fromString $ T.unpack t) <> "."
]
Just dir ->
case mapMaybe (childOf dir) $ Map.toList locals of
[] -> pure $ Left $
Expand Down

0 comments on commit bdc2f80

Please sign in to comment.