summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-16 00:49:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-16 00:49:09 -0400
commit2bb6b02948da8a33b2edcd911fcf3c2597b0ee58 (patch)
tree631f0694c7b5a17064eb66862230ec666e3871a8 /Command
parent84784e2ca1ababf21342cba36f7e65b4c3cd303b (diff)
When not run in a git repository, git-annex can still display a usage message, and "git annex version" even works.
Things that sound simple, but are made hard by the Annex monad being built with the assumption that there will always be a git repo.
Diffstat (limited to 'Command')
-rw-r--r--Command/Version.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Command/Version.hs b/Command/Version.hs
index a58426482..9fb7fe5bd 100644
--- a/Command/Version.hs
+++ b/Command/Version.hs
@@ -13,7 +13,7 @@ import qualified Build.SysConfig as SysConfig
import Annex.Version
def :: [Command]
-def = [dontCheck repoExists $
+def = [noRepo showPackageVersion $ dontCheck repoExists $
command "version" paramNothing seek "show version info"]
seek :: [CommandSeek]
@@ -23,7 +23,7 @@ start :: CommandStart
start = do
v <- getVersion
liftIO $ do
- putStrLn $ "git-annex version: " ++ SysConfig.packageversion
+ showPackageVersion
putStrLn $ "local repository version: " ++ fromMaybe "unknown" v
putStrLn $ "default repository version: " ++ defaultVersion
putStrLn $ "supported repository versions: " ++ vs supportedVersions
@@ -31,3 +31,6 @@ start = do
stop
where
vs = join " "
+
+showPackageVersion :: IO ()
+showPackageVersion = putStrLn $ "git-annex version: " ++ SysConfig.packageversion