From 652d3e82208da8a0b1bd052c7284b5904e59d20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 9 Nov 2025 15:21:56 +0100 Subject: Destination type and config section --- src/Destination.hs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/Destination.hs (limited to 'src/Destination.hs') diff --git a/src/Destination.hs b/src/Destination.hs new file mode 100644 index 0000000..f96e88c --- /dev/null +++ b/src/Destination.hs @@ -0,0 +1,32 @@ +module Destination ( + Destination, + DeclaredDestination(..), + DestinationName(..), + + openDestination, +) where + +import Data.Text (Text) +import Data.Text qualified as T + +import System.Directory + + +data Destination + = FilesystemDestination FilePath + +data DeclaredDestination = DeclaredDestination + { destinationName :: DestinationName + , destinationUrl :: Maybe Text + } + + +newtype DestinationName = DestinationName Text + deriving (Eq, Ord, Show) + + +openDestination :: Text -> IO Destination +openDestination url = do + let path = T.unpack url + createDirectoryIfMissing True path + return $ FilesystemDestination path -- cgit v1.2.3