1{-# LANGUAGE LambdaCase #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Obelisk.Configs.Internal.Directory where
6import Data.ByteString (ByteString)
7import qualified Data.ByteString as BS
9import qualified Data.Map as Map
10import Data.Text (Text)
11import qualified Data.Text as T
12import System.Directory
13import System.FilePath.Posix
15getConfigsFromDirectory :: FilePath -> IO (Map Text ByteString)
16getConfigsFromDirectory base = doesDirectoryExist base >>= \case
18 ps <- listDirectory base
19 fmap mconcat $ forM ps $ \p -> do
20 subdirConfigs <- getConfigsFromDirectory $ base </> p
21 pure $ Map.mapKeys (T.pack . (p </>) . T.unpack) subdirConfigs
22 False -> doesFileExist base >>= \case
23 True -> Map.singleton "" <$> BS.readFile base
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list