on master help sign in
print every subdir of libdir as a package

This is a quick and dirty solution for #1071. I wish I were able to implement output of metadata, but since there is no metadata saved (currently) alongside of a package, there is nothing to display. Displaying metadata in the output of this subcommand would mean that there have to happen further improvements in the package-system of idris. Please see my proposal in #1126.

commit7cef7ea1b8ba69485c5351a7e85afed4319b94d6 authorNorbert Melzer <timmelzer@gmail.com> dateFri 2 Jan 2015, 22:00 (12 years ago) parent7fedc76
2 files changed+9
idris.cabal+1 main/Main.hs+8
idris.cabal+1
@@ -794,6 +794,7 @@ Executable idris
794794 Build-depends: idris
795795 , base
796796 , filepath
797+ , directory
797798 , haskeline >= 0.7
798799 , transformers
799800
main/Main.hs+8
@@ -45,6 +45,7 @@ runIdris opts = do
4545 when (ShowIncs `elem` opts) $ runIO showIncs
4646 when (ShowLibs `elem` opts) $ runIO showLibs
4747 when (ShowLibdir `elem` opts) $ runIO showLibdir
48+ when (ShowPkgs `elem` opts) $ runIO showPkgs
4849 case opt getClient opts of
4950 [] -> return ()
5051 (c:_) -> do setVerbose False
@@ -92,3 +93,10 @@ showIncs :: IO b
9293showIncs = do incFlags <- getIncFlags
9394 putStrLn $ unwords incFlags
9495 exitWith ExitSuccess
96+
97+-- | List idris packages installed
98+showPkgs :: IO b
99+showPkgs = do dir <- getIdrisLibDir
100+ pkgs <- getDirectoryContents dir
101+ mapM putStrLn (filter (/= ".") . filter (/= "..") $ pkgs)
102+ exitWith ExitSuccess