aboutsummaryrefslogtreecommitdiff
path: root/Command/Version.hs
blob: 4d18469c6c437bd42030231f082eb30aaa659762 (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 Control.Monad.State (liftIO)
import Data.String.Utils

import Command
import qualified SysConfig
import Version
import Upgrade

command :: [Command]
command = [Command "version" paramNothing seek "show versions"]

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

start :: CommandStartNothing
start = do
	liftIO $ putStrLn $ "git-annex version: " ++ SysConfig.packageversion
	v <- getVersion
	let v' = case v of
		Just s -> s
		Nothing -> "unknown"
	liftIO $ putStrLn $ "local repository version: " ++ v'
	liftIO $ putStrLn $ "default repository version: " ++ defaultVersion
	liftIO $ putStrLn $ "supported repository versions: " ++ vs supportedVersions
	liftIO $ putStrLn $ "upgrade supported from repository versions: " ++ vs upgradableVersions
	return Nothing
	where
		vs l = join " " l