summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
authorSibi Prabakaran <sibi@psibi.in>2015-12-07 11:16:15 +0100
committerBen Gamari <ben@smart-cactus.org>2015-12-07 11:17:43 +0100
commit3d55e41e72dc32281744c52afea380c1db577ee1 (patch)
tree7904d021e08e3184c9acbe50cb89ae0ee349de52 /utils/ghc-pkg
parent42a5469e52d84a04df33f516fcb74ffa7ed70359 (diff)
downloadhaskell-3d55e41e72dc32281744c52afea380c1db577ee1.tar.gz
ghc-pkg: Restore old behavior in colored version; fixes 6119
The behavior is changed to this: ``` ghc-pkg list blahblah /home/sibi/ghc/inplace/lib/package.conf.d (no packages) ``` instead of: ``` ghc-pkg list blahblah /home/sibi/ghc/inplace/lib/package.conf.d ``` Reviewers: austin, thomie, bgamari Reviewed By: thomie, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1575 GHC Trac Issues: #6119
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r--utils/ghc-pkg/Main.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 993aa12ae9..b089e7b9c9 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -1271,10 +1271,13 @@ listPackages verbosity my_flags mPackageName mModuleName = do
mapM_ show_normal stack
#else
let
- show_colour withF db =
- mconcat $ map (<#> termText "\n") $
- (termText (location db) :
- map (termText " " <#>) (map pp_pkg (packages db)))
+ show_colour withF db@PackageDB{ packages = pkg_confs } =
+ if null pkg_confs
+ then termText (location db) <#> termText "\n (no packages)\n"
+ else
+ mconcat $ map (<#> termText "\n") $
+ (termText (location db) :
+ map (termText " " <#>) (map pp_pkg pkg_confs))
where
pp_pkg p
| installedComponentId p `elem` broken = withF Red doc