summaryrefslogtreecommitdiff
path: root/Pancake.hs
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-11-13 00:15:12 +0300
committerdefanor <defanor@uberspace.net>2017-11-13 00:15:12 +0300
commit36f86bfe407e261c102eabfc65397fdf23661ee8 (patch)
treec6b52392429bdbe808048980882d76a32143881d /Pancake.hs
parentfae50fdc7ae4a200ef17e40c9ac41eb42518f6c6 (diff)
Handle the --version option
Diffstat (limited to 'Pancake.hs')
-rw-r--r--Pancake.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Pancake.hs b/Pancake.hs
index a2c37f8..2b5784a 100644
--- a/Pancake.hs
+++ b/Pancake.hs
@@ -32,6 +32,7 @@ import Control.Exception
import Data.Char
import System.IO.Error
import Control.Applicative
+import Data.Version
import Pancake.Common
import Pancake.Configuration
@@ -39,6 +40,7 @@ import Pancake.Command
import Pancake.Reading
import Pancake.Rendering
import Pancake.Printing
+import Paths_pancake
-- | A zipper kind of thing, for scrolling and history traversal.
type Sliding a = ([a], [a])
@@ -250,6 +252,8 @@ eventLoop = do
main :: IO ()
main = do
args <- getArgs
- _ <- runStateT (updateConfig >> eventLoop) $
- LS ([],[]) 0 [] def ("--embedded" `elem` args)
- pure ()
+ if "--version" `elem` args
+ then putStrLn $ "pancake " ++ showVersion version
+ else runStateT (updateConfig >> eventLoop)
+ (LS ([],[]) 0 [] def ("--embedded" `elem` args))
+ >> pure ()