| ... |
... |
@@ -193,9 +193,11 @@ defaultGhciSettings = |
|
193
|
193
|
fullHelpText = defFullHelpText
|
|
194
|
194
|
}
|
|
195
|
195
|
|
|
|
196
|
+versionString :: String
|
|
|
197
|
+versionString = "GHCi, version " ++ cProjectVersion
|
|
|
198
|
+
|
|
196
|
199
|
ghciWelcomeMsg :: String
|
|
197
|
|
-ghciWelcomeMsg = "GHCi, version " ++ cProjectVersion ++
|
|
198
|
|
- ": https://www.haskell.org/ghc/ :? for help"
|
|
|
200
|
+ghciWelcomeMsg = versionString ++ ": https://www.haskell.org/ghc/ :? for help"
|
|
199
|
201
|
|
|
200
|
202
|
ghciCommands :: [Command]
|
|
201
|
203
|
ghciCommands = map mkCmd [
|
| ... |
... |
@@ -253,6 +255,7 @@ ghciCommands = map mkCmd [ |
|
253
|
255
|
("unadd", keepGoingPaths unAddModule, completeFilename),
|
|
254
|
256
|
("undef", keepGoing undefineMacro, completeMacro),
|
|
255
|
257
|
("unset", keepGoing unsetOptions, completeSetOptions),
|
|
|
258
|
+ ("version", keepGoing showVersion', noCompletion),
|
|
256
|
259
|
("where", keepGoing whereCmd, noCompletion),
|
|
257
|
260
|
("instances", keepGoing' instancesCmd, completeExpression)
|
|
258
|
261
|
] ++ map mkCmdHidden [ -- hidden commands
|
| ... |
... |
@@ -366,6 +369,7 @@ defFullHelpText = |
|
366
|
369
|
" :type +d <expr> show the type of <expr>, defaulting type variables\n" ++
|
|
367
|
370
|
" :unadd <module> ... remove module(s) from the current target set\n" ++
|
|
368
|
371
|
" :undef <cmd> undefine user-defined command :<cmd>\n" ++
|
|
|
372
|
+ " :version display the current GHC version\n" ++
|
|
369
|
373
|
" ::<cmd> run the builtin command\n" ++
|
|
370
|
374
|
" :!<command> run the shell command <command>\n" ++
|
|
371
|
375
|
" :shell <command> run shell via sh -c <command>\n" ++
|
| ... |
... |
@@ -3626,6 +3630,9 @@ unsetOptions str |
|
3626
|
3630
|
no_flags <- mapM no_flag minus_opts
|
|
3627
|
3631
|
when (not (null no_flags)) $ newDynFlags False no_flags
|
|
3628
|
3632
|
|
|
|
3633
|
+showVersion' :: GhciMonad m => String -> m ()
|
|
|
3634
|
+showVersion' _ = liftIO (putStrLn versionString)
|
|
|
3635
|
+
|
|
3629
|
3636
|
isMinus :: String -> Bool
|
|
3630
|
3637
|
isMinus ('-':_) = True
|
|
3631
|
3638
|
isMinus _ = False
|