Skip to content

Commit

Permalink
Add --version to the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleidukos committed Mar 7, 2024
1 parent 59cf8ed commit cb1af96
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import Effectful
import Effectful.Error.Static
import Options.Applicative
import System.Exit

import Data.Text (Text)
import Data.Text.Display (display)
import Data.Vector (Vector)

import Extract
import Types
import Data.Version (showVersion)
import Paths_get_tested (version)

data Options = Options
{ path :: FilePath
Expand All @@ -28,7 +30,7 @@ data Options = Options

main :: IO ()
main = do
result <- execParser (parseOptions `withInfo` "Extract the tested-with stanza from your cabal file")
result <- execParser (parseOptions `withInfo` "Generate a test matrix from the tested-with stanza of your cabal file")
processingResult <- runEff . runErrorNoCallStack $ runOptions result
case processingResult of
Right json -> ByteString.putStrLn json
Expand All @@ -49,6 +51,7 @@ parseOptions =
<*> optional (strOption (long "ubuntu-version" <> metavar "VERSION" <> help "Enable the Ubuntu runner with the selected version"))
<*> switch (long "windows" <> help "(legacy) Enable the Windows runner's latest version")
<*> optional (strOption (long "windows-version" <> metavar "VERSION" <> help "Enable the Windows runner with the selected version"))
<**> simpleVersioner (showVersion version)

runOptions :: Options -> Eff [Error ProcessingError, IOE] ByteString
runOptions options = do
Expand Down
Binary file added get-tested
Binary file not shown.
5 changes: 3 additions & 2 deletions get-tested.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.4
name: get-tested
version: 0.1.6.0
version: 0.1.7.0
synopsis: Get the tested-with stanza of your Cabal file

-- description:
Expand All @@ -9,7 +9,7 @@ license: BSD-3-Clause
license-file: LICENSE
author: Hécate Moonlight
maintainer: hecate+github@glitchbra.in
tested-with: GHC ==9.6.2
tested-with: GHC ==9.6.4

-- copyright:
category: Development
Expand Down Expand Up @@ -49,6 +49,7 @@ executable get-tested
other-modules:
Extract
Types
Paths_get_tested

build-depends:
, aeson ^>=2.1
Expand Down

0 comments on commit cb1af96

Please sign in to comment.