summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-10-11 21:31:00 +0100
committerIan Lynagh <ian@well-typed.com>2012-10-11 21:31:00 +0100
commit55478b1ef856d47fba7e7dbd86baa88030d1b1cf (patch)
tree9c73425de4d4717c6640e7c5841fa87dcfb20547 /utils/ghc-pkg
parente9b1256229698c0fe297852106b249acfa05c9e6 (diff)
downloadhaskell-55478b1ef856d47fba7e7dbd86baa88030d1b1cf.tar.gz
ghc-pkg: Print something when no packages are found; fixes #6119
We used to say $ ghc-pkg list blargle /usr/local/lib/ghc-7.4.1/package.conf.d which may imply that blargle was found in /usr/local/lib/ghc-7.4.1/package.conf.d
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r--utils/ghc-pkg/Main.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index d992b5405f..0f5bd1545c 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -985,7 +985,10 @@ listPackages verbosity my_flags mPackageName mModuleName = do
broken = map sourcePackageId (brokenPackages pkg_map)
show_normal PackageDB{ location = db_name, packages = pkg_confs } =
- hPutStrLn stdout $ unlines ((db_name ++ ":") : map (" " ++) pp_pkgs)
+ do hPutStrLn stdout (db_name ++ ":")
+ if null pp_pkgs
+ then hPutStrLn stdout " (no packages)"
+ else hPutStrLn stdout $ unlines (map (" " ++) pp_pkgs)
where
pp_pkgs = map pp_pkg pkg_confs
pp_pkg p