"list --simple-output" should be quiet when there are no packages to list
authorSimon Marlow <simonmar@microsoft.com>
Wed, 12 Dec 2007 10:22:30 +0000 (10:22 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Wed, 12 Dec 2007 10:22:30 +0000 (10:22 +0000)
Previously:

$ ghc-pkg list --user --simple-output
ghc-pkg: no matches
$

Now:

$ ghc-pkg list --user --simple-output
$

utils/ghc-pkg/Main.hs

index feb88cb..ef5cb39 100644 (file)
@@ -506,8 +506,8 @@ listPackages flags mPackageName mModuleName = do
                                                       else showPackageId
               pkgs = map showPkg $ sortBy compPkgIdVer $
                           map package (concatMap snd db_stack)
-          when (null pkgs) $ die "no matches"
-          hPutStrLn stdout $ concat $ intersperse " " pkgs
+          when (not (null pkgs)) $ 
+             hPutStrLn stdout $ concat $ intersperse " " pkgs
 
 -- -----------------------------------------------------------------------------
 -- Prints the highest (hidden or exposed) version of a package