@@ -16,17 +16,19 @@ import Paths_idris
1616
1717import Util.System
1818
19−data Opts = Opts { inputs :: [FilePath],
19+data Opts = Opts { really :: Bool,
20+ inputs :: [FilePath],
2021 interface :: Bool,
2122 output :: FilePath }
2223
23−showUsage = do putStrLn "Usage: idris-c <ibc-files> [-o <output-file>]"
24+showUsage = do putStrLn "Usage: idris-codegen-c --yes-really <ibc-files> [-o <output-file>]"
2425 exitWith ExitSuccess
2526
2627getOpts :: IO Opts
2728getOpts = do xs <- getArgs
28− return $ process (Opts [] False "a.out") xs
29+ return $ process (Opts False [] False "a.out") xs
2930 where
31+ process opts ("--yes-really":xs) = process (opts { really = True }) xs
3032 process opts ("-o":o:xs) = process (opts { output = o }) xs
3133 process opts ("--interface":xs) = process (opts { interface = True }) xs
3234 process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
@@ -36,7 +38,7 @@ c_main :: Opts -> Idris ()
3638c_main opts = do runIO setupBundledCC
3739 elabPrims
3840 loadInputs (inputs opts) Nothing
39− mainProg <- if interface opts
41+ mainProg <- if interface opts
4042 then liftM Just elabMain
4143 else return Nothing
4244 ir <- compile (Via "c") (output opts) mainProg
@@ -44,9 +46,9 @@ c_main opts = do runIO setupBundledCC
4446
4547main :: IO ()
4648main = do opts <- getOpts
47− if (null (inputs opts))
49+ if (null (inputs opts))
4850 then showUsage
49− else runMain (c_main opts)
50−
51−
52−
51+ else if (not $ really opts)
52+ then do putStrLn "This is not what you may expect it is."
53+ showUsage
54+ else runMain (c_main opts)