summaryrefslogtreecommitdiff
path: root/src/Destination.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-11-09 15:21:56 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-11-09 19:48:02 +0100
commit652d3e82208da8a0b1bd052c7284b5904e59d20a (patch)
treec14961759ea1684d126f2832cf9177874aa1e82a /src/Destination.hs
parentf449ef32e31e10b9412e932f0181ccfa4314e728 (diff)
Destination type and config section
Diffstat (limited to 'src/Destination.hs')
-rw-r--r--src/Destination.hs32
1 files changed, 32 insertions, 0 deletions
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