1module Obelisk.ExecutableConfig (get) where
3import Control.Exception (bracket)
4import qualified Data.ByteString as BS
6import qualified Data.Text as T
7import qualified Data.Text.Encoding as T
8import Foreign.C.String (withCString)
9import Foreign.Ptr (nullPtr)
10import System.FilePath.Posix ((</>))
12import Obelisk.ExecutableConfig.Internal.AssetManager
14get :: Text -> IO (Maybe Text)
15get name = bracket getAssets freeAssetManager $ \mgrObj -> do
16 mgr <- assetManagerFromJava mgrObj
18 a <- withCString ("config" </> T.unpack name) $ \fn ->
19 assetManager_open mgr fn 3
20 return $ if unAAsset a == nullPtr
23 close = mapM_ asset_close
24 bracket open close $ mapM $ \asset -> do
25 b <- asset_getBuffer asset
26 l <- asset_getLength asset
27 fmap T.decodeUtf8 $ BS.packCStringLen (b, fromIntegral l)
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