diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2025-11-09 15:21:56 +0100 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-11-09 19:48:02 +0100 |
| commit | 652d3e82208da8a0b1bd052c7284b5904e59d20a (patch) | |
| tree | c14961759ea1684d126f2832cf9177874aa1e82a /src/Destination.hs | |
| parent | f449ef32e31e10b9412e932f0181ccfa4314e728 (diff) | |
Destination type and config section
Diffstat (limited to 'src/Destination.hs')
| -rw-r--r-- | src/Destination.hs | 32 |
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 |