3import System.Exit (ExitCode(..), exitSuccess, exitWith)
5import Control.Monad (unless, when)
15import Util.System (setupBundledCC)
17processShowOptions :: [Opt] -> Idris ()
18processShowOptions opts = runIO $ do
19 when (ShowAll `elem` opts) $ showExitIdrisInfo
20 when (ShowLoggingCats `elem` opts) $ showExitIdrisLoggingCategories
21 when (ShowIncs `elem` opts) $ showExitIdrisFlagsInc
22 when (ShowLibs `elem` opts) $ showExitIdrisFlagsLibs
23 when (ShowLibDir `elem` opts) $ showExitIdrisLibDir
24 when (ShowDocDir `elem` opts) $ showExitIdrisDocDir
25 when (ShowPkgs `elem` opts) $ showExitIdrisInstalledPackages
27check :: [Opt] -> (Opt -> Maybe a) -> ([a] -> Idris ()) -> Idris ()
28check opts extractOpts action = do
29 case opt extractOpts opts of
34processClientOptions :: [Opt] -> Idris ()
35processClientOptions opts = check opts getClient $ \fs -> case fs of
36 [] -> ifail "No --client argument. This indicates a bug. Please report."
41 Just DontListen -> ifail "\"--client\" and \"--port none\" are incompatible"
42 Just (ListenPort port) -> runIO $ runClient (Just port) c
43 Nothing -> runIO $ runClient Nothing c
45processPackageOptions :: [Opt] -> Idris ()
46processPackageOptions opts = do
47 check opts getPkgCheck $ \fs -> runIO $ do
48 mapM_ (checkPkg opts (WarnOnly `elem` opts) True) fs
49 check opts getPkgClean $ \fs -> runIO $ do
50 mapM_ (cleanPkg opts) fs
51 check opts getPkgMkDoc $ \fs -> runIO $ do
52 mapM_ (documentPkg opts) fs
53 check opts getPkgTest $ \fs -> runIO $ do
55 codes <- mapM (testPkg opts) fs
56 -- check if any of the tests exited with an exit code other
57 -- than zero; if they did, exit with exit code 1
58 unless (null $ filter (/= ExitSuccess) codes) $
59 exitWith (ExitFailure 1)
61 check opts getPkg $ \fs -> runIO $ do
62 mapM_ (buildPkg opts (WarnOnly `elem` opts)) fs
63 check opts getPkgREPL $ \fs -> case fs of
65 _ -> ifail "Too many packages"
67-- | The main function for the Idris executable.
68runIdris :: [Opt] -> Idris ()
71 processShowOptions opts -- Show information then quit.
72 processClientOptions opts -- Be a client to a REPL server.
73 processPackageOptions opts -- Work with Idris packages.
74 idrisMain opts -- Launch REPL or compile mode.
76-- Main program reads command line options, parses the main program, and gets
81 runMain (runIdris opts)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list