aboutsummaryrefslogtreecommitdiff
path: root/app/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 7e821e5..6901fa6 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -19,10 +19,18 @@ main = do
PackagistCommand packagistArguments ->
latestPackagist packagistArguments
TextCommand textArguments -> latestText textArguments
- GhCommand ghArguments -> latestGitHub settings ghArguments (stripPrefix "v")
+ GhCommand ghArguments@GhArguments{ transform } ->
+ latestGitHub settings ghArguments $ chooseTransformFunction transform
Text.IO.putStrLn $ fromMaybe "" latestVersion
where
+ chooseTransformFunction (Just "php") = phpTransform
+ chooseTransformFunction (Just "rdiff-backup") = Text.stripPrefix "v"
+ chooseTransformFunction _ = stripPrefix "v"
stripPrefix prefix string = Just
$ fromMaybe string
$ Text.stripPrefix prefix string
+ phpTransform version
+ | (majorPrefix, patchVersion) <- Text.breakOnEnd "." version
+ , majorPrefix == "php-8.2." = Just $ Text.drop (Text.length "php-") version
+ | otherwise = Nothing