version: Add --raw

This commit is contained in:
Joey Hess 2015-04-02 15:37:39 -04:00
parent 294991dacb
commit 7a44dacb74
3 changed files with 21 additions and 2 deletions

View file

@ -18,16 +18,28 @@ import qualified Remote
import qualified Backend
cmd :: [Command]
cmd = [noCommit $ noRepo startNoRepo $ dontCheck repoExists $
cmd = [withOptions [rawOption] $
noCommit $ noRepo startNoRepo $ dontCheck repoExists $
command "version" paramNothing seek SectionQuery "show version info"]
rawOption :: Option
rawOption = flagOption [] "raw" "output only program version"
seek :: CommandSeek
seek = withNothing start
seek = withNothing $ ifM (getOptionFlag rawOption) (startRaw, start)
startRaw :: CommandStart
startRaw = do
liftIO $ do
putStr SysConfig.packageversion
hFlush stdout
stop
start :: CommandStart
start = do
v <- getVersion
liftIO $ do
showPackageVersion
info "local repository version" $ fromMaybe "unknown" v
info "supported repository version" supportedVersion

1
debian/changelog vendored
View file

@ -25,6 +25,7 @@ git-annex (5.20150328) UNRELEASED; urgency=medium
* Fix truncation of parameters that could occur when using xargs git-annex.
* Significantly sped up processing of large numbers of directories
passed to a single git-annex command.
* version: Add --raw
-- Joey Hess <id@joeyh.name> Fri, 27 Mar 2015 16:04:43 -0400

View file

@ -19,6 +19,12 @@ corresponds to the git ref from git-annex's source repository that was
built. Therefore, "5.20150320-gdd35cf3" is a daily build, and
"5.20150401" is an April 1st release made a bit later.
# OPTIONS
* `--raw`
Causes only git-annex's version to be output, and nothing else.
# SEE ALSO
[[git-annex]](1)