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