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 /Command | |
parent | 473a64e5e8b6fc3f3bd396c1756754ad057e3009 (diff) |
version: Add --raw
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Version.hs | 16 |
1 files changed, 14 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 |