on master help sign in
improve help messages

Bonus: usage is not shown on incorrect codegen args

commit524c223ee12f0bc9869fb7fcfd7186a21968dc44 authorСухарик <suhr@i2pmail.org> dateFri 4 Sep 2015, 04:17 (11 years ago) parent18450ff
3 files changed+15−9
codegen/idris-codegen-c/Main.hs+5−3 codegen/idris-codegen-javascript/Main.hs+5−3 codegen/idris-codegen-node/Main.hs+5−3
codegen/idris-codegen-c/Main.hs+5−3
@@ -21,7 +21,8 @@ data Opts = Opts { really :: Bool,
2121 interface :: Bool,
2222 output :: FilePath }
2323
24−showUsage = do putStrLn "Usage: idris-codegen-c --yes-really <ibc-files> [-o <output-file>]"
24+showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user.\n"
25+ putStrLn "Usage: idris-codegen-c --yes-really <ibc-files> [-o <output-file>]"
2526 exitWith ExitSuccess
2627
2728getOpts :: IO Opts
@@ -49,6 +50,7 @@ main = do opts <- getOpts
4950 if (null (inputs opts))
5051 then showUsage
5152 else if (not $ really opts)
52− then do putStrLn "This is not what you may expect it is."
53− showUsage
53+ then do putStrLn "This code generator is intended to be called by the Idris compiler. \
54+ \Please pass Idris the '--codegen' flag to choose a backend."
55+ exitWith ExitSuccess
5456 else runMain (c_main opts)
codegen/idris-codegen-javascript/Main.hs+5−3
@@ -18,7 +18,8 @@ data Opts = Opts { really :: Bool
1818 , output :: FilePath
1919 }
2020
21−showUsage = do putStrLn "Usage: idris-codegen-javascript --yes-really <ibc-files> [-o <output-file>]"
21+showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user.\n"
22+ putStrLn "Usage: idris-codegen-javascript --yes-really <ibc-files> [-o <output-file>]"
2223 exitWith ExitSuccess
2324
2425getOpts :: IO Opts
@@ -42,6 +43,7 @@ main = do opts <- getOpts
4243 if (null (inputs opts))
4344 then showUsage
4445 else if (not $ really opts)
45− then do putStrLn "This is not what you may expect it is."
46− showUsage
46+ then do putStrLn "This code generator is intended to be called by the Idris compiler. \
47+ \Please pass Idris the '--codegen' flag to choose a backend."
48+ exitWith ExitSuccess
4749 else runMain (jsMain opts)
codegen/idris-codegen-node/Main.hs+5−3
@@ -18,7 +18,8 @@ data Opts = Opts { really :: Bool
1818 , output :: FilePath
1919 }
2020
21−showUsage = do putStrLn "Usage: idris-codegen-node --yes-really <ibc-files> [-o <output-file>]"
21+showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user.\n"
22+ putStrLn "Usage: idris-codegen-node --yes-really <ibc-files> [-o <output-file>]"
2223 exitWith ExitSuccess
2324
2425getOpts :: IO Opts
@@ -42,6 +43,7 @@ main = do opts <- getOpts
4243 if (null (inputs opts))
4344 then showUsage
4445 else if (not $ really opts)
45− then do putStrLn "This is not what you may expect it is."
46− showUsage
46+ then do putStrLn "This code generator is intended to be called by the Idris compiler. \
47+ \Please pass Idris the '--codegen' flag to choose a backend."
48+ exitWith ExitSuccess
4749 else runMain (jsMain opts)