aboutsummaryrefslogtreecommitdiff
path: root/Command/Version.hs
blob: c8507cd5ac25526dfccd906637577cf48fe0feb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{- git-annex command
 -
 - Copyright 2010 Joey Hess <joey@kitenet.net>
 -
 - Licensed under the GNU GPL version 3 or higher.
 -}

module Command.Version where

import Common.Annex
import Command
import qualified Build.SysConfig as SysConfig
import Annex.Version
import BuildFlags

def :: [Command]
def = [noCommit $ noRepo showPackageVersion $ dontCheck repoExists $
	command "version" paramNothing seek SectionQuery "show version info"]

seek :: [CommandSeek]
seek = [withNothing start]

start :: CommandStart
start = do
	v <- getVersion
	liftIO $ do
		showPackageVersion
		putStrLn $ "local repository version: " ++ fromMaybe "unknown" v
		putStrLn $ "default repository version: " ++ defaultVersion
		putStrLn $ "supported repository versions: " ++ unwords supportedVersions
		putStrLn $ "upgrade supported from repository versions: " ++ unwords upgradableVersions
	stop

showPackageVersion :: IO ()
showPackageVersion = do
	putStrLn $ "git-annex version: " ++ SysConfig.packageversion
	putStrLn $ "build flags: " ++ unwords buildFlags