|
1 | 1 | {-# LANGUAGE NoImplicitPrelude #-}
|
2 | 2 | {-# LANGUAGE DataKinds #-}
|
3 | 3 | {-# LANGUAGE GADTs #-}
|
| 4 | +{-# LANGUAGE MultiWayIf #-} |
4 | 5 | {-# LANGUAGE OverloadedStrings #-}
|
5 | 6 | {-# LANGUAGE ViewPatterns #-}
|
6 | 7 |
|
@@ -153,11 +154,26 @@ parseRawTargetDirs root locals ri =
|
153 | 154 | mdir <- liftIO $ forgivingAbsence (resolveDir root (T.unpack t))
|
154 | 155 | >>= rejectMissingDir
|
155 | 156 | case mdir of
|
156 |
| - Nothing -> pure $ Left $ |
157 |
| - fillSep |
158 |
| - [ flow "Directory not found:" |
159 |
| - , style Dir (fromString $ T.unpack t) <> "." |
160 |
| - ] |
| 157 | + Nothing -> pure . Left $ |
| 158 | + if | T.isPrefixOf "stack-yaml" t -> |
| 159 | + fillSep |
| 160 | + [ flow "Directory not found:" |
| 161 | + , style Dir (fromString $ T.unpack t) <> "." |
| 162 | + , flow "Is this a typo? Can I suggest:" |
| 163 | + , style Dir (fromString $ "--" ++ T.unpack t) |
| 164 | + ] |
| 165 | + | T.isSuffixOf ".yaml" t -> |
| 166 | + fillSep |
| 167 | + [ flow "Directory not found:" |
| 168 | + , style Dir (fromString $ T.unpack t) <> "." |
| 169 | + , flow "Is this a typo? Can I suggest:" |
| 170 | + , style Dir (fromString $ "--stack-yaml " ++ T.unpack t) |
| 171 | + ] |
| 172 | + | otherwise -> |
| 173 | + fillSep |
| 174 | + [ flow "Directory not found:" |
| 175 | + , style Dir (fromString $ T.unpack t) <> "." |
| 176 | + ] |
161 | 177 | Just dir ->
|
162 | 178 | case mapMaybe (childOf dir) $ Map.toList locals of
|
163 | 179 | [] -> pure $ Left $
|
|
0 commit comments