Commit 8907e037 authored by Michael Hanus's avatar Michael Hanus
Browse files

Add --using option

parent 577de1db
......@@ -2,7 +2,7 @@
--- A universal REPL which can be used on top of a Curry compiler
---
--- @author Michael Hanus
--- @version September 2021
--- @version October 2021
------------------------------------------------------------------------------
module REPL.Main where
......@@ -71,6 +71,8 @@ processArgsAndStart rst []
| quit rst = cleanUpAndExitRepl rst
| otherwise = do
writeVerboseInfo rst 1 (ccBanner (compiler rst))
unless (null (usingOption rst)) $ writeVerboseInfo rst 1 $
"(using " ++ usingOption rst ++ ")\n"
writeVerboseInfo rst 1 $
"Type \":h\" for help (contact: " ++ ccEmail (compiler rst) ++ ")"
when (currMod rst == "Prelude") $ do
......@@ -83,6 +85,8 @@ processArgsAndStart rst (arg:args)
= processArgsAndStart rst args
-- ignore '--nocypm|-n' or '--noreadline'
-- (since they already processed by separate script to invoke the REPL)
| arg == "--using" && not (null args)
= processArgsAndStart rst { usingOption = head args } (tail args)
| arg `elem` ["-n", "--nocypm", "--noreadline"]
= processArgsAndStart rst args
| arg == "-h" || arg == "--help" || arg == "-?"
......@@ -128,6 +132,7 @@ printHelp = putStrLn $ unlines
, "--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"
......
......@@ -2,7 +2,7 @@
--- The state of the REPL.
---
--- @author Michael Hanus
--- @version September 2021
--- @version October 2021
------------------------------------------------------------------------------
module REPL.State where
......@@ -20,6 +20,7 @@ import REPL.Compiler
data ReplState = ReplState
{ compiler :: CCDescription
, usingOption :: String -- option for "using" text in banner
, rcVars :: [(String, String)] -- content of rc file
, verbose :: Int -- verbosity level:
-- 0 = errors and warnings
......@@ -56,6 +57,7 @@ initReplState cd = do
mainmod <- getUnusedMod ("Main" ++ compilerid ++ show pid)
return $ ReplState
{ compiler = cd
, usingOption = ""
, rcVars = []
, verbose = 1
, libPaths = splitSearchPath (ccLibPath cd)
......
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