diff options
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 |