on master help sign in
Addition of a command line flag `--info`.
cb210b1Jan de Muijnck-Hughes
CHANGELOG.md+1
@@ -33,6 +33,7 @@
33* Idris' documentation system now displays the documentation for auto
33* Idris' documentation system now displays the documentation for auto
34 implicits in the output of `:doc`. This is tested for in `docs005`.
34 implicits in the output of `:doc`. This is tested for in `docs005`.
35
35
36+* New command line flag `--info` that displays information about the installation.
36## Miscellaneous updates
37## Miscellaneous updates
37
38
38* The test suite now uses [tasty-golden](https://hackage.haskell.org/package/tasty-golden). New tests must be registered in `test/TestData.hs`, as explained in the relevant `README.md`.
39* The test suite now uses [tasty-golden](https://hackage.haskell.org/package/tasty-golden). New tests must be registered in `test/TestData.hs`, as explained in the relevant `README.md`.
main/Main.hs+1
@@ -29,6 +29,7 @@ main = do opts <- runArgParser
29runIdris :: [Opt] -> Idris ()
29runIdris :: [Opt] -> Idris ()
30runIdris opts = do
30runIdris opts = do
31 runIO setupBundledCC
31 runIO setupBundledCC
32+ when (ShowAll `elem` opts) $ runIO showExitIdrisInfo
32 when (ShowLoggingCats `elem` opts) $ runIO showExitIdrisLoggingCategories
33 when (ShowLoggingCats `elem` opts) $ runIO showExitIdrisLoggingCategories
33 when (ShowIncs `elem` opts) $ runIO showExitIdrisFlagsInc
34 when (ShowIncs `elem` opts) $ runIO showExitIdrisFlagsInc
34 when (ShowLibs `elem` opts) $ runIO showExitIdrisFlagsLibs
35 when (ShowLibs `elem` opts) $ runIO showExitIdrisFlagsLibs
src/Idris/AbsSyntaxTree.hs+1
@@ -550,6 +550,7 @@ data Opt = Filename String
550 | ColourREPL Bool
550 | ColourREPL Bool
551 | Idemode
551 | Idemode
552 | IdemodeSocket
552 | IdemodeSocket
553+ | ShowAll
553 | ShowLibs
554 | ShowLibs
554 | ShowLibdir
555 | ShowLibdir
555 | ShowIncs
556 | ShowIncs
src/Idris/CmdOptions.hs+1
@@ -114,6 +114,7 @@ parseFlags = many $
114 <|> flag' ErrContext (long "errorcontext")
114 <|> flag' ErrContext (long "errorcontext")
115
115
116 -- Show things
116 -- Show things
117+ <|> flag' ShowAll (long "info" <> help "Display information about installation.")
117 <|> flag' ShowLoggingCats (long "listlogcats" <> help "Display logging categories")
118 <|> flag' ShowLoggingCats (long "listlogcats" <> help "Display logging categories")
118 <|> flag' ShowLibs (long "link" <> help "Display link flags")
119 <|> flag' ShowLibs (long "link" <> help "Display link flags")
119 <|> flag' ShowPkgs (long "listlibs" <> help "Display installed libraries")
120 <|> flag' ShowPkgs (long "listlibs" <> help "Display installed libraries")
src/Idris/Info.hs+1−1
@@ -74,4 +74,4 @@ getIdrisInstalledPackages :: IO [String]
74getIdrisInstalledPackages = installedPackages
74getIdrisInstalledPackages = installedPackages
75
75
76getIdrisLoggingCategories :: IO [String]
76getIdrisLoggingCategories :: IO [String]
77−getIdrisLoggingCategories = pure $ words loggingCatsStr
77+getIdrisLoggingCategories = return $ words loggingCatsStr
src/Idris/Info/Show.hs+39
@@ -54,3 +54,42 @@ showExitIdrisLoggingCategories :: IO ()
54showExitIdrisLoggingCategories = do
54showExitIdrisLoggingCategories = do
55 showIdrisLoggingCategories
55 showIdrisLoggingCategories
56 exitSuccess
56 exitSuccess
57+
58+showIdrisInfo :: IO ()
59+showIdrisInfo = do
60+ putStrLn $ unwords ["Idris", getIdrisVersion]
61+
62+ ps <- getIdrisInstalledPackages
63+ putStrLn $ unwords (["Installed Packages:"] ++ ps)
64+
65+ cs <- getIdrisLoggingCategories
66+ putStrLn $ unwords (["Logging Categories:"] ++ cs)
67+
68+ putStrLn "Paths:"
69+ ldir <- getIdrisLibDir
70+ udir <- getIdrisUserDataDir
71+ putStrLn $ unwords ["-", "Library Dir:", ldir]
72+ putStrLn $ unwords ["-", "User Dir:", udir]
73+
74+ putStrLn "Flags:"
75+ lflag <- getIdrisFlagsLib
76+ iflag <- getIdrisFlagsInc
77+ eflag <- getIdrisFlagsEnv
78+ putStrLn $ unwords (["-", "Libraries:", show lflag])
79+ putStrLn $ unwords (["-", "Includes:", show iflag])
80+ putStrLn $ unwords (["-", "Env:", show eflag])
81+
82+ cc <- getIdrisCC
83+ putStrLn $ unwords ["CC:", cc]
84+
85+ putStrLn "Files:"
86+ hfile <- getIdrisHistoryFile
87+ iscript <- getIdrisInitScript
88+ putStrLn $ unwords (["-", "History File:", hfile])
89+ putStrLn $ unwords (["-", "REPL Init Script", iscript])
90+
91+
92+showExitIdrisInfo :: IO ()
93+showExitIdrisInfo = do
94+ showIdrisInfo
95+ exitSuccess