on master help sign in
add ":version" REPL command

Outputs the current Idris version (produced by `getIdrisVersion`).

commit4a2e0acb43c9c13a0ef964ae938f0f6e2c15307d authorMichael Morgan <morgan.michael@me.com> dateTue 21 Nov 2017, 17:22 (9 years ago) parent5f822a5
3 files changed+4
src/Idris/REPL.hs+2 src/Idris/REPL/Commands.hs+1 src/Idris/REPL/Parser.hs+1
src/Idris/REPL.hs+2
@@ -601,6 +601,7 @@ splitName s = case reverse $ splitOn "." s of
601601 unparen str = str
602602
603603idemodeProcess :: FilePath -> Command -> Idris ()
604+idemodeProcess fn ShowVersion = process fn ShowVersion
604605idemodeProcess fn Warranty = process fn Warranty
605606idemodeProcess fn Help = process fn Help
606607idemodeProcess fn (RunShellCommand cmd) =
@@ -828,6 +829,7 @@ insertScript prf (x : xs) = x : insertScript prf xs
828829
829830process :: FilePath -> Command -> Idris ()
830831process fn Help = iPrintResult displayHelp
832+process fn ShowVersion = iPrintResult getIdrisVersion
831833process fn Warranty = iPrintResult warranty
832834process fn (RunShellCommand cmd) = runIO $ system cmd >> return ()
833835process fn (ChangeDirectory f)
src/Idris/REPL/Commands.hs+1
@@ -71,6 +71,7 @@ data Command = Quit
7171 | CallsWho Name
7272 | Browse [String]
7373 | MakeDoc String -- IdrisDoc
74+ | ShowVersion
7475 | Warranty
7576 | PrintDef Name
7677 | PPrint OutputFmt Int PTerm
src/Idris/REPL/Parser.hs+1
@@ -111,6 +111,7 @@ parserCommandsForHelp =
111111 , (["consolewidth"], ConsoleWidthArg, "Set the width of the console", cmd_consolewidth)
112112 , (["printerdepth"], OptionalArg NumberArg, "Set the maximum pretty-printer depth (no arg for infinite)", cmd_printdepth)
113113 , noArgCmd ["q", "quit"] Quit "Exit the Idris system"
114+ , noArgCmd ["version"] ShowVersion "Display the Idris version"
114115 , noArgCmd ["warranty"] Warranty "Displays warranty information"
115116 , (["let"], ManyArgs DeclArg
116117 , "Evaluate a declaration, such as a function definition, instance implementation, or fixity declaration"