From 7a44dacb74b6f45b7b4302ab8c744ce6075f8087 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Apr 2015 15:37:39 -0400 Subject: [PATCH] version: Add --raw --- Command/Version.hs | 16 ++++++++++++++-- debian/changelog | 1 + doc/git-annex-version.mdwn | 6 ++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Command/Version.hs b/Command/Version.hs index c0c89af684..1b96de9d2f 100644 --- a/Command/Version.hs +++ b/Command/Version.hs @@ -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 diff --git a/debian/changelog b/debian/changelog index 7188f28603..adddf91aae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Fri, 27 Mar 2015 16:04:43 -0400 diff --git a/doc/git-annex-version.mdwn b/doc/git-annex-version.mdwn index 14b10163d7..7f37470111 100644 --- a/doc/git-annex-version.mdwn +++ b/doc/git-annex-version.mdwn @@ -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)