@@ -285,15 +285,16 @@ simplifyTargets includeTests includeBenches =
285285 getLocalComp _ = Left ()
286286
287287parseTargets :: (MonadThrow m , MonadIO m )
288- => Bool -- ^ include tests
288+ => Bool -- ^ using implicit global?
289+ -> Bool -- ^ include tests
289290 -> Bool -- ^ include benchmarks
290291 -> Map PackageName Version -- ^ snapshot
291292 -> Map PackageName Version -- ^ extra deps
292293 -> Map PackageName LocalPackageView
293294 -> Path Abs Dir -- ^ current directory
294295 -> [Text ] -- ^ command line targets
295296 -> m (Map PackageName Version , Map PackageName SimpleTarget )
296- parseTargets includeTests includeBenches snap extras locals currDir textTargets' = do
297+ parseTargets implicitGlobal includeTests includeBenches snap extras locals currDir textTargets' = do
297298 let textTargets =
298299 if null textTargets'
299300 then map (T. pack . packageNameString) $ Map. keys $ Map. filter (not . lpvExtraDep) locals
@@ -310,8 +311,9 @@ parseTargets includeTests includeBenches snap extras locals currDir textTargets'
310311
311312 if null errs
312313 then if Map. null targets
313- -- TODO perhaps check if we're using the implicit global and,
314- -- if so, recommend running stack init/new?
315- then throwM $ TargetParseException [" The specified targets matched no packages" ]
314+ then throwM $ TargetParseException
315+ $ if implicitGlobal
316+ then [" The specified targets matched no packages.\n Perhaps you need to run 'stack init'?" ]
317+ else [" The specified targets matched no packages" ]
316318 else return (Map. unions newExtras, targets)
317319 else throwM $ TargetParseException errs
0 commit comments