Commit 5f98327e authored by Michael Hanus's avatar Michael Hanus
Browse files

Add REPL compiler parameter to describe additional options for invoking the...

Add REPL compiler parameter to describe additional options for invoking the REPL. This description is shown with the `--help` option.
parent 9a16577a
......@@ -30,6 +30,12 @@ c2go = CCDescription
"curry2go" -- the compiler name
(1,0,0) -- the version number
c2goBanner -- the banner
-- description of specific REPL options:
[ ("-n|--nocypm",
"do not invoke `cypm' to compute package load path")
, ("--noreadline",
"do not use input line editing via command `rlwrap'")
]
c2goHome -- home directory of the compiler
"info@curry-lang.org" -- contact email
(c2goHome ++ "/bin/curry2go-frontend") -- executable of the Curry front end
......
......@@ -7,7 +7,7 @@
--- > cypm curry :l JucsREPL.curry :save :q
---
--- @author Michael Hanus
--- @version October 2021
--- @version February 2022
------------------------------------------------------------------------------
module JucsREPL where
......@@ -28,6 +28,7 @@ jucs = CCDescription
"jucs" -- the compiler name
(1,0,0) -- the version number
jucsBanner -- the banner
[] -- description of specific REPL options
jucsHome -- home directory of the compiler
"info@curry-lang.org" -- contact email
(installDir ++ "/bin/pakcs-frontend") -- executable of the Curry front end
......
......@@ -5,7 +5,7 @@
--- > cypm curry :l PakcsREPL.curry :save :q
---
--- @author Michael Hanus
--- @version October 2021
--- @version February 2022
------------------------------------------------------------------------------
module PakcsREPL where
......@@ -30,6 +30,12 @@ pakcs = CCDescription
"pakcs" -- the compiler name
(3,4,0) -- the version number
pakcsBanner -- the banner
-- description of specific REPL options:
[ ("-n|--nocypm",
"do not invoke `cypm' to compute package load path")
, ("--noreadline",
"do not use input line editing via command `rlwrap'")
]
pakcsHome -- home directory of the compiler
"pakcs@curry-lang.org" -- contact email
(pakcsHome ++ "/bin/pakcs-frontend") -- executable of the Curry front end
......
......@@ -55,6 +55,9 @@ data CCDescription = CCDescription
{ ccName :: String -- the name of the compiler
, ccVersion :: (Int,Int,Int) -- major/minor/revision version
, ccBanner :: String -- the banner shown for the compiler
, ccMainOpts :: [(String,String)]-- a description (option/explanation) of
-- further options to be listed with the
-- `--help` options of the REPL
, ccHome :: String -- home directory of the compiler
, ccEmail :: String -- contact email (shown at startup)
, ccFrontend :: String -- the executable of the Curry front end
......
......@@ -90,7 +90,7 @@ processArgsAndStart rst (arg:args)
| arg `elem` ["-n", "--nocypm", "--noreadline"]
= processArgsAndStart rst args
| arg == "-h" || arg == "--help" || arg == "-?"
= printHelp >> cleanUpAndExitRepl rst
= printHelp rst >> cleanUpAndExitRepl rst
| arg == "-q" || arg == "--quiet"
= processArgsAndStart rst { verbose = 0 } args
| arg == "-V" || arg == "--version"
......@@ -105,9 +105,9 @@ processArgsAndStart rst (arg:args)
| isCommand arg = do
let (cmdargs, more) = break isCommand args
mbrst <- processCommand rst (tail (unwords (arg:cmdargs)))
maybe printHelp (\rst' -> processArgsAndStart rst' more) mbrst
maybe (printHelp rst) (\rst' -> processArgsAndStart rst' more) mbrst
| otherwise
= writeErrorMsg ("unknown command: " ++ unwords (arg:args)) >> printHelp
= writeErrorMsg ("unknown command: " ++ unwords (arg:args)) >> printHelp rst
where
versionOpts = ["--compiler-name", "--numeric-version", "--base-version"]
......@@ -117,27 +117,27 @@ isCommand s = case s of
':' : _ -> True
_ -> False
printHelp :: IO ()
printHelp = putStrLn $ unlines
printHelp :: ReplState -> IO ()
printHelp rst = putStrLn $ unlines $
[ "Invoke interactive environment:"
, ""
, " <repl> <options> [ -- <run-time arguments>]"
, ""
, "with options:"
, ""
, "-h|--help|-? : show this message and quit"
, "-V|--version : show version and quit"
, "--compiler-name : show the compiler name and quit"
, "--numeric-version : show the compiler version number and quit"
, "--base-version : show the version of the base libraries and quit"
, "-q|--quiet : work silently"
, "-n|--nocypm : do not invoke `cypm' to compute package load path"
, "--using <s> : set string for 'using' message in banner"
, "--noreadline : do not use input line editing via command `rlwrap'"
, "-Dprop=val : define rc property `prop' as `val'"
, ":<cmd> <args> : commands of the interactive environment"
, ""
]
, ""] ++
formatVarVals ": "
(ccMainOpts (compiler rst) ++
[ ("-h|--help|-?" , "show this message and quit")
, ("-V|--version" , "show version and quit")
, ("--compiler-name" , "show the compiler name and quit")
, ("--numeric-version", "show the compiler version number and quit")
, ("--base-version ", "show the version of the base libraries and quit")
, ("-q|--quiet" , "work silently")
, ("--using <s>" , "set string for 'using' message in banner")
, ("-Dprop=val" , "define rc property `prop' as `val'")
, (":<cmd> <args>" , "commands of the interactive environment")
]) ++
[ "" ]
-- ---------------------------------------------------------------------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment