mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
07bc7cacf2
commit
fed1845ec8
|
@ -729,6 +729,10 @@ runForms ss = for_ ss $ \s -> do
|
|||
ListVal [SymbolVal "builtin:update-indexes"] -> do
|
||||
updateIndexes
|
||||
|
||||
ListVal [SymbolVal "builtin:scan-magic"] -> do
|
||||
magic <- scanMagic
|
||||
liftIO $ print $ pretty magic
|
||||
|
||||
ListVal [SymbolVal "builtin:select-fixme-hash", FixmeHashLike x] -> do
|
||||
w <- selectFixmeHash x
|
||||
liftIO $ print $ pretty w
|
||||
|
@ -739,7 +743,6 @@ runForms ss = for_ ss $ \s -> do
|
|||
Left (fn,h) -> liftIO $ print $ "N" <+> pretty h <+> pretty fn
|
||||
Right (fn,h) -> liftIO $ print $ "E" <+> pretty h <+> pretty fn
|
||||
|
||||
|
||||
ListVal (SymbolVal "builtin:git:extract-file-meta-data" : StringLikeList fs) -> do
|
||||
fxm <- gitExtractFileMetaData fs <&> HM.toList
|
||||
liftIO $ print $ vcat (fmap (pretty.snd) fxm)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{-# Language MultiWayIf #-}
|
||||
module Fixme.Scan (scanBlob) where
|
||||
module Fixme.Scan (scanBlob,scanMagic) where
|
||||
|
||||
import Fixme.Prelude hiding (indent)
|
||||
import Fixme.Types
|
||||
|
@ -52,6 +52,21 @@ data FixmeWhat = FixmeHead Int Int Text Text
|
|||
|
||||
data P = P0 [FixmePart] | P1 Int Fixme [FixmePart]
|
||||
|
||||
|
||||
scanMagic :: FixmePerks m => FixmeM m HashRef
|
||||
scanMagic = do
|
||||
env <- ask
|
||||
w <- atomically do
|
||||
tagz <- fixmeEnvTags env & readTVar
|
||||
co <- fixmeEnvDefComments env & readTVar
|
||||
fco <- fixmeEnvFileComments env & readTVar
|
||||
m <- fixmeEnvFileMask env & readTVar
|
||||
a <- fixmeEnvAttribs env & readTVar
|
||||
v <- fixmeEnvAttribValues env & readTVar
|
||||
|
||||
pure $ serialise (tagz, co, fco, m, a, v)
|
||||
pure $ HashRef $ hashObject w
|
||||
|
||||
scanBlob :: forall m . FixmePerks m
|
||||
=> Maybe FilePath -- ^ filename to detect type
|
||||
-> ByteString -- ^ content
|
||||
|
|
Loading…
Reference in New Issue