3import System.Console.Haskeline
5import System.Environment
7import System.FilePath ((</>), addTrailingPathSeparator)
11import Control.Monad.Trans.Error ( ErrorT(..) )
12import Control.Monad.Trans.State.Strict ( execStateT, get, put )
13import Control.Monad ( when )
16import Core.ShellParser
21import Core.Constraints
27import Idris.Primitives
31import Util.System ( getLibFlags, getIdrisLibDir, getIncFlags )
32import Util.DynamicLinker
38-- Main program reads command line options, parses the main program, and gets
41main = do xs <- getArgs
42 let opts = parseArgs xs
43 result <- runErrorT $ execStateT (runIdris opts) idrisInit
45 Left err -> putStrLn $ "Uncaught error: " ++ show err
48runIdris :: [Opt] -> Idris ()
49runIdris [Client c] = do setVerbose False
53 when (Ver `elem` opts) $ runIO showver
54 when (Usage `elem` opts) $ runIO usage
55 when (ShowIncs `elem` opts) $ runIO showIncs
56 when (ShowLibs `elem` opts) $ runIO showLibs
57 when (ShowLibdir `elem` opts) $ runIO showLibdir
58 case opt getPkgClean opts of
60 fs -> do runIO $ mapM_ cleanPkg fs
61 runIO $ exitWith ExitSuccess
62 case opt getPkg opts of
63 [] -> idrisMain opts -- in Idris.REPL
64 fs -> runIO $ mapM_ (buildPkg (WarnOnly `elem` opts)) fs
66usage = do putStrLn usagemsg
69showver = do putStrLn $ "Idris version " ++ ver
72showLibs = do libFlags <- getLibFlags
76showLibdir = do dir <- getIdrisLibDir
80showIncs = do incFlags <- getIncFlags
84usagemsg = "Idris version " ++ ver ++ "\n" ++
85 "--------------" ++ map (\x -> '-') ver ++ "\n" ++
86 "Usage: idris [input file] [options]\n" ++
88 "\t--quiet Quiet mode (for editors)\n" ++
89 "\t--[no]colour Control REPL colour highlighting\n" ++
90 "\t--check Type check only\n" ++
91 "\t-o [file] Specify output filename\n" ++
92 "\t-i [dir] Add directory to the list of import paths\n" ++
93 "\t--ibcsubdir [dir] Write IBC files into sub directory\n" ++
94 "\t--noprelude Don't import the prelude\n" ++
95 "\t--total Require functions to be total by default\n" ++
96 "\t--warnpartial Warn about undeclared partial functions\n" ++
97 "\t--typeintype Disable universe checking\n" ++
98 "\t--log [level] Type debugging log level\n" ++
99 "\t-S Do no further compilation of code generator output\n" ++
100 "\t-c Compile to object files rather than an executable\n" ++
101 "\t--mvn Create a maven project (for Java codegen)\n" ++
102 "\t--exec [expr] Execute the expression expr in the interpreter,\n" ++
103 "\t defaulting to Main.main if none provided, and exit.\n" ++
104 "\t--ideslave Ideslave mode (for editors; in/ouput wrapped in \n" ++
105 "\t s-expressions)\n" ++
106 "\t--libdir Show library install directory and exit\n" ++
107 "\t--link Show C library directories and exit (for C linking)\n" ++
108 "\t--include Show C include directories and exit (for C linking)\n" ++
109 "\t--codegen [cg] Select code generator: C, Java, bytecode, javascript,\n" ++
110 "\t node or llvm\n" ++
111 "\t--target [triple] Select target triple (for LLVM codegen)\n" ++
112 "\t--cpu [cpu] Select target CPU (e.g. corei7 or cortex-m3) (for LLVM codegen)\n"
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