From 2126488066713719e26a1049adb080e68ec124f1 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 25 Aug 2023 10:30:24 +0200 Subject: Implement clone command in the binary --- app/Main.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app/Main.hs') diff --git a/app/Main.hs b/app/Main.hs index eea4951..654dcf7 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -13,6 +13,7 @@ import qualified Toml import qualified Data.Text as Text import Control.Monad.Trans.Reader (ReaderT(..)) import SlackBuilder.Download +import Text.URI (mkURI) main :: IO () main = do @@ -38,8 +39,12 @@ main = do <$> remoteFileExists urlPath ArchiveCommand repo nameVersion tarball tagPrefix -> cloneAndArchive repo nameVersion tarball tagPrefix >> pure Nothing - DownloadCommand url target -> fmap (Text.pack . show) - <$> download url target + DownloadCommand url target + | Just uri <- mkURI url -> fmap (Text.pack . show) + <$> download uri target + | otherwise -> pure Nothing + CloneCommand repo tarball tagPrefix -> fmap (Text.pack . show) + <$> clone repo tarball tagPrefix chooseTransformFunction (Just "php") = phpTransform chooseTransformFunction (Just "rdiff-backup") = Text.stripPrefix "v" chooseTransformFunction _ = stripPrefix "v" -- cgit v1.2.3