Skip to content

Commit 9cf4634

Browse files
amaebelalt-romes
authored andcommitted
Add --version flag
1 parent cb0e76e commit 9cf4634

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

haskell-debugger.cabal

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ executable hdb
104104
Development.Debug.Adapter.Exit,
105105
Development.Debug.Adapter.Handles,
106106
Development.Debug.Adapter,
107-
Development.Debug.Interactive
107+
Development.Debug.Interactive,
108+
Paths_haskell_debugger
109+
autogen-modules: Paths_haskell_debugger
108110
build-depends:
109111
base, ghc,
110112
exceptions, aeson, bytestring,

hdb/Main.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module Main where
33

44
import System.Environment
55
import Data.Maybe
6+
import Data.Version
67
import Text.Read
78

89
import DAP
@@ -27,6 +28,8 @@ import GHC.IO.Handle.FD
2728
import Options.Applicative hiding (command)
2829
import qualified Options.Applicative
2930

31+
import qualified Paths_haskell_debugger as P
32+
3033
-- | The options `hdb` is invoked in the command line with
3134
data HdbOptions
3235
-- | @server --port <port>@
@@ -90,9 +93,13 @@ hdbOptionsParser = hsubparser
9093
)
9194
<|> cliParser -- Default to CLI mode if no subcommand
9295

96+
-- | Parser for --version flag
97+
versioner :: Parser (a -> a)
98+
versioner = simpleVersioner $ "Haskell Debugger, version " ++ showVersion P.version
99+
93100
-- | Main parser info
94101
hdbParserInfo :: ParserInfo HdbOptions
95-
hdbParserInfo = info (hdbOptionsParser <**> helper)
102+
hdbParserInfo = info (hdbOptionsParser <**> versioner <**> helper)
96103
( fullDesc
97104
<> header "Haskell debugger supporting both CLI and DAP modes" )
98105

0 commit comments

Comments
 (0)