Skip to content

Commit 4acbba6

Browse files
committed
Add versionner
1 parent e0e7222 commit 4acbba6

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

exe/Main.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module Main where
22

3+
import Paths_kda_tool (version)
34
------------------------------------------------------------------------------
45
import AppMain
56
------------------------------------------------------------------------------
67

78
main :: IO ()
8-
main = appMain
9+
main = appMain version

kda-tool.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ executable kda
112112
build-depends:
113113
base
114114
, kda-tool
115+
116+
other-modules: Paths_kda_tool
117+
115118
hs-source-dirs: exe
116119
default-language: Haskell2010
117120
ghc-options: -threaded -Wall -Wno-unticked-promoted-constructors -fno-show-valid-hole-fits

src/AppMain.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module AppMain where
99
import Control.Monad.IO.Class
1010
import Data.Aeson
1111
import Data.Default
12+
import Data.Version
1213
import Data.String (fromString)
1314
import Katip
1415
import Network.HTTP.Client hiding (withConnection)
@@ -35,8 +36,9 @@ import Commands.WalletSign
3536
import Types.Env
3637
------------------------------------------------------------------------------
3738

38-
appMain :: IO ()
39-
appMain = do
39+
40+
appMain :: Version -> IO ()
41+
appMain version = do
4042
Args c severity verbosity mcf <- execParser opts
4143
mgr <- newManager tlsManagerSettings
4244

@@ -76,7 +78,7 @@ appMain = do
7678
WalletSign args -> walletSignCommand theEnv args
7779

7880
where
79-
opts = info (envP <**> helper) $ mconcat
81+
opts = info (envP <**> simpleVersioner (showVersion version) <**> helper) $ mconcat
8082
[ fullDesc
8183
, header "kda - Command line tool for interacting with the Kadena blockchain"
8284
, footerDoc (Just theFooter)
@@ -86,4 +88,3 @@ appMain = do
8688
, ""
8789
, "source <(kda --bash-completion-script `which kda`)"
8890
]
89-

0 commit comments

Comments
 (0)