Kleidukos / get-tested

Go get tested! Github Actions matrix generator for your haskell projects' CI
BSD 3-Clause "New" or "Revised" License
45 stars 3 forks source link

Add a `check` mode #49

Open mmhat opened 2 months ago

mmhat commented 2 months ago

Is it possible to have a check mode, that tells you whether a given GHC version is in the get-tested stanza of a Cabal file or not? What I mean is something like this:

$ get-tested get-tested.cabal
["9.10.1"]
$ get-tested check get-tested.cabal 9.10.1; echo $?
0
$ get-tested check get-tested.cabal 9.8.2; echo $?
1
$ get-tested check get-tested.cabal 9.8.2 9.10.1; echo $?
1

I know I can work around that (e.g. get-tested get-tested.cabal | jq --raw-output '.[]' | grep -q '9.10.1'), but that's rather hacky...

Kleidukos commented 2 months ago

Oh that's hacky indeed, jq provides a contains() filter for you already:

❯ get-tested *.cabal
["9.6.6","9.8.2","9.10.1"]

❯ get-tested *.cabal | jq 'contains(["9.10.1"])'
true