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.
This commit is contained in:
parent
84784e2ca1
commit
2bb6b02948
9 changed files with 38 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue