diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-04-02 15:37:39 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-04-02 15:37:39 -0400 |
commit | c44d8d03ffb626dde84966381c52e1eabc6b81d3 (patch) | |
tree | 8f88676eda8a64baafb558e4ac6dc9027db31119 | |
parent | 473a64e5e8b6fc3f3bd396c1756754ad057e3009 (diff) |
version: Add --raw
-rw-r--r-- | Command/Version.hs | 16 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/git-annex-version.mdwn | 6 |
3 files changed, 21 insertions, 2 deletions
diff --git a/Command/Version.hs b/Command/Version.hs index c0c89af68..1b96de9d2 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 7188f2860..adddf91aa 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 <id@joeyh.name> Fri, 27 Mar 2015 16:04:43 -0400 diff --git a/doc/git-annex-version.mdwn b/doc/git-annex-version.mdwn index 14b10163d..7f3747011 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) |