From 5a9e87cd5f65439ef8f2717b3b3e561f42f2e24c Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 10 Aug 2023 12:47:43 +0200 Subject: Move gh check to the Haskell binary --- app/Main.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app/Main.hs') 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 -- cgit v1.2.3