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 )
18import Core.Constraints
24import Idris.Primitives
28import Util.System ( getLibFlags, getIdrisLibDir, getIncFlags )
29import Util.DynamicLinker
35-- Main program reads command line options, parses the main program, and gets
38main = do xs <- getArgs
39 let opts = parseArgs xs
40 result <- runErrorT $ execStateT (runIdris opts) idrisInit
42 Left err -> putStrLn $ "Uncaught error: " ++ show err
45runIdris :: [Opt] -> Idris ()
46runIdris [Client c] = do setVerbose False
50 when (Ver `elem` opts) $ runIO showver
51 when (Usage `elem` opts) $ runIO usage
52 when (ShowIncs `elem` opts) $ runIO showIncs
53 when (ShowLibs `elem` opts) $ runIO showLibs
54 when (ShowLibdir `elem` opts) $ runIO showLibdir
55 case opt getPkgClean opts of
57 fs -> do runIO $ mapM_ cleanPkg fs
58 runIO $ exitWith ExitSuccess
59 case opt getPkg opts of
60 [] -> idrisMain opts -- in Idris.REPL
61 fs -> runIO $ mapM_ (buildPkg (WarnOnly `elem` opts)) fs
63usage = do putStrLn usagemsg
66showver = do putStrLn $ "Idris version " ++ ver
69showLibs = do libFlags <- getLibFlags
73showLibdir = do dir <- getIdrisLibDir
77showIncs = do incFlags <- getIncFlags
81usagemsg = "Idris version " ++ ver ++ "\n" ++
82 "--------------" ++ map (\x -> '-') ver ++ "\n" ++
83 "Usage: idris [input file] [options]\n" ++
85 "\t--quiet Quiet mode (for editors)\n" ++
86 "\t--[no]colour Control REPL colour highlighting\n" ++
87 "\t--check Type check only\n" ++
88 "\t-o [file] Specify output filename\n" ++
89 "\t-i [dir] Add directory to the list of import paths\n" ++
90 "\t--ibcsubdir [dir] Write IBC files into sub directory\n" ++
91 "\t--noprelude Don't import the prelude\n" ++
92 "\t--total Require functions to be total by default\n" ++
93 "\t--warnpartial Warn about undeclared partial functions\n" ++
94 "\t--typeintype Disable universe checking\n" ++
95 "\t--log [level] Type debugging log level\n" ++
96 "\t-S Do no further compilation of code generator output\n" ++
97 "\t-c Compile to object files rather than an executable\n" ++
98 "\t--mvn Create a maven project (for Java codegen)\n" ++
99 "\t--exec [expr] Execute the expression expr in the interpreter,\n" ++
100 "\t defaulting to Main.main if none provided, and exit.\n" ++
101 "\t--ideslave Ideslave mode (for editors; in/ouput wrapped in \n" ++
102 "\t s-expressions)\n" ++
103 "\t--libdir Show library install directory and exit\n" ++
104 "\t--link Show C library directories and exit (for C linking)\n" ++
105 "\t--include Show C include directories and exit (for C linking)\n" ++
106 "\t--codegen [cg] Select code generator: C, Java, bytecode, javascript,\n" ++
107 "\t node or llvm\n" ++
108 "\t--target [triple] Select target triple (for LLVM codegen)\n" ++
109 "\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