diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-10-17 10:01:23 +0200 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-10-17 10:15:27 +0200 |
commit | da12170e694872fd91f81a27748eed07dc3f75cc (patch) | |
tree | db17e301360b83327ac47881cb81d409bcfef46b /app/Issue/Tag.hs | |
parent | bb88dbe078a0f16c0626a2825fd9f4d6bc775875 (diff) |
add filter operators
The following filter expressions are now additionally valid:
```
--filter @tag <=VALUE
--filter @tag <VALUE
--filter @tag >=VALUE
--filter @tag >VALUE
```
Note that negation needs some re-work. Currently, only `--filter !@tag
<VALUE` is valid, and `--filter @tag !<VALUE` is not. The first version
may not behave as you would expect it.
A tracking issue has been created.
Note that without typing tag values, all comparisons perform
lexicographically on `String`s.
Diffstat (limited to 'app/Issue/Tag.hs')
-rw-r--r-- | app/Issue/Tag.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/Issue/Tag.hs b/app/Issue/Tag.hs index 8b6d6d4..85636b5 100644 --- a/app/Issue/Tag.hs +++ b/app/Issue/Tag.hs @@ -1,4 +1,11 @@ -module Issue.Tag (Tag (..), extractTags, internalTags) where +module Issue.Tag + ( Tag (..), + extractTags, + internalTags, + tagKey, + tagValue, + ) +where import Data.Binary (Binary) import Data.Maybe (catMaybes) @@ -10,6 +17,12 @@ import Issue.Provenance (Provenance (..)) data Tag = Tag Text (Maybe Text) deriving (Show, Generic, Binary) +tagKey :: Tag -> Text +tagKey (Tag k _) = k + +tagValue :: Tag -> Maybe Text +tagValue (Tag _ v) = v + extractTags :: Text -> [Tag] extractTags = catMaybes |