Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "--yes-really" argument has been removed from idris. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import IRTS.CodegenJava
import System.Environment
import System.Exit

data Opts = Opts { really :: Bool,
inputs :: [FilePath],
data Opts = Opts { inputs :: [FilePath],
output :: FilePath }

showUsage = do putStrLn "Usage: idris-java <ibc-files> [-o <output-file>]"
showUsage = do putStrLn "Usage: idris-codegen-java <ibc-files> [-o <output-file>]"
putStrLn "Note for humans: You likely want to use this via the idris executable"
putStrLn "by adding '--codegen java' to the idris command."
exitWith ExitSuccess

getOpts :: IO Opts
getOpts = do xs <- getArgs
return $ process (Opts False [] "a.out") xs
return $ process (Opts [] "a.out") xs
where
process opts ("--yes-really":xs) = process (opts { really = True }) xs
process opts ("-o":o:xs) = process (opts { output = o }) xs
process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
process opts [] = opts
Expand All @@ -38,11 +38,7 @@ main :: IO ()
main = do opts <- getOpts
if (null (inputs opts))
then showUsage
else if (not $ really opts)
then do putStrLn "This code generator is intended to be called by the Idris compiler. \
\Please pass Idris the '--codegen' flag to choose a backend."
exitWith ExitSuccess
else runMain (java_main opts)
else runMain (java_main opts)