summaryrefslogtreecommitdiff
path: root/app/Main.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2023-08-10 12:47:43 +0200
committerEugen Wissner <belka@caraus.de>2023-08-10 12:47:43 +0200
commit5a9e87cd5f65439ef8f2717b3b3e561f42f2e24c (patch)
treebf5c0c2d854dbabbb6d95925d63143f1ed75a878 /app/Main.hs
parent43ebbc5e6705d2cf86650f1918e28b9b7e94406d (diff)
downloadslackbuilder-5a9e87cd5f65439ef8f2717b3b3e561f42f2e24c.tar.gz
Move gh check to the Haskell binary
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