Improve NoDownload Pretty instance on missing/unknown "mtarget"
The guard was only used for the "Perhaps you meant"-part, so include the other part regardless of what `mtarget` is.
This commit is contained in:
parent
df192ee18e
commit
dfe213824f
@ -212,20 +212,22 @@ data NoDownload = NoDownload GHCTargetVersion Tool (Maybe PlatformRequest)
|
|||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
instance Pretty NoDownload where
|
instance Pretty NoDownload where
|
||||||
pPrint (NoDownload tver@(GHCTargetVersion mtarget vv) tool mpfreq)
|
pPrint (NoDownload tver@(GHCTargetVersion mtarget vv) tool mpfreq) =
|
||||||
| (Just target) <- mtarget
|
let helperMsg
|
||||||
, target `elem` (T.pack . prettyShow <$> enumFromTo (minBound :: Tool) (maxBound :: Tool))
|
| (Just target) <- mtarget
|
||||||
= text $ "Unable to find a download for "
|
, target `elem` (T.pack . prettyShow <$> enumFromTo (minBound :: Tool) (maxBound :: Tool)) =
|
||||||
|
"\nPerhaps you meant: 'ghcup <command> "
|
||||||
|
<> T.unpack target
|
||||||
|
<> " "
|
||||||
|
<> T.unpack (prettyVer vv)
|
||||||
|
<> "'"
|
||||||
|
| otherwise = ""
|
||||||
|
in text $ "Unable to find a download for "
|
||||||
<> show tool
|
<> show tool
|
||||||
<> " version '"
|
<> " version "
|
||||||
<> T.unpack (tVerToText tver)
|
<> "'" <> T.unpack (tVerToText tver) <> "'"
|
||||||
<> maybe "'\n" (\pfreq -> "' on detected platform " <> pfReqToString pfreq <> "\n") mpfreq
|
<> maybe "" (\pfreq -> " on detected platform " <> pfReqToString pfreq) mpfreq
|
||||||
<> "Perhaps you meant: 'ghcup <command> "
|
<> helperMsg
|
||||||
<> T.unpack target
|
|
||||||
<> " "
|
|
||||||
<> T.unpack (prettyVer vv)
|
|
||||||
<> "'"
|
|
||||||
| otherwise = text $ "Unable to find a download for " <> T.unpack (tVerToText tver)
|
|
||||||
|
|
||||||
instance HFErrorProject NoDownload where
|
instance HFErrorProject NoDownload where
|
||||||
eBase _ = 10
|
eBase _ = 10
|
||||||
|
Loading…
Reference in New Issue
Block a user