summaryrefslogtreecommitdiff
path: root/Command/Version.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-19 14:38:34 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-19 14:38:34 -0400
commit2ec349a18d96ba41bae98ac94830f9b8d8fa2598 (patch)
treefe6b3b8f961ec5cc8a028966b7469ec5613852f8 /Command/Version.hs
parent1562ec8aba6fd179dd99f88890e2f463e9e15c3c (diff)
Add version command to show git-annex version as well as repository version information.
(cherry picked from commit 828a84ba3341d4b7a84292d8b9002a8095dd2382) Conflicts: GitAnnex.hs Upgrade.hs Version.hs debian/changelog
Diffstat (limited to 'Command/Version.hs')
-rw-r--r--Command/Version.hs37
1 files changed, 37 insertions, 0 deletions
diff --git a/Command/Version.hs b/Command/Version.hs
new file mode 100644
index 000000000..4d18469c6
--- /dev/null
+++ b/Command/Version.hs
@@ -0,0 +1,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