mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
d8b2a3ff25
commit
80feaeb3f5
|
@ -52,3 +52,7 @@ fixme-comments ";" "--"
|
||||||
|
|
||||||
(set-template default short)
|
(set-template default short)
|
||||||
|
|
||||||
|
(define (ls) (report))
|
||||||
|
|
||||||
|
(define (stage) (fixme:stage:show))
|
||||||
|
|
||||||
|
|
|
@ -271,6 +271,27 @@ runTop forms = do
|
||||||
fme <- lift listFixmies
|
fme <- lift listFixmies
|
||||||
pure ()
|
pure ()
|
||||||
|
|
||||||
|
entry $ bindMatch "delete" $ nil_ \case
|
||||||
|
[FixmeHashLike hash] -> lift $ delete hash
|
||||||
|
|
||||||
|
_ -> throwIO $ BadFormException @C nil
|
||||||
|
|
||||||
|
entry $ bindMatch "modify" $ nil_ \case
|
||||||
|
[FixmeHashLike hash, StringLike a, StringLike b] -> do
|
||||||
|
lift $ modify_ hash a b
|
||||||
|
|
||||||
|
_ -> throwIO $ BadFormException @C nil
|
||||||
|
|
||||||
|
entry $ bindMatch "fixme:stage:show" $ nil_ $ const do
|
||||||
|
stage <- lift selectStage
|
||||||
|
liftIO $ print $ vcat (fmap pretty stage)
|
||||||
|
|
||||||
|
entry $ bindMatch "fixme:stage:drop" $ nil_ $ const do
|
||||||
|
lift cleanStage
|
||||||
|
|
||||||
|
entry $ bindMatch "fixme:stage:clean" $ nil_ $ const do
|
||||||
|
lift cleanStage
|
||||||
|
|
||||||
entry $ bindMatch "fixme:scan-git-local" $ nil_ $ const do
|
entry $ bindMatch "fixme:scan-git-local" $ nil_ $ const do
|
||||||
lift $ scanGitLocal mempty Nothing
|
lift $ scanGitLocal mempty Nothing
|
||||||
|
|
||||||
|
@ -304,5 +325,10 @@ runTop forms = do
|
||||||
|
|
||||||
conf <- readConfig
|
conf <- readConfig
|
||||||
|
|
||||||
run dict (conf <> forms) >>= eatNil display
|
argz <- liftIO getArgs
|
||||||
|
|
||||||
|
let args = zipWith (\i s -> bindValue (mkId ("%" <> show i)) (mkStr @C s )) [1..] argz
|
||||||
|
& HM.unions
|
||||||
|
|
||||||
|
run (dict <> args) (conf <> forms) >>= eatNil display
|
||||||
|
|
||||||
|
|
|
@ -291,3 +291,18 @@ cat_ metaOnly hash = do
|
||||||
|
|
||||||
liftIO $ action dict (LBS8.unlines w)
|
liftIO $ action dict (LBS8.unlines w)
|
||||||
|
|
||||||
|
|
||||||
|
delete :: FixmePerks m => Text -> FixmeM m ()
|
||||||
|
delete txt = do
|
||||||
|
acts <- asks fixmeEnvUpdateActions >>= readTVarIO
|
||||||
|
hashes <- selectFixmeHashes txt
|
||||||
|
for_ hashes $ \ha -> do
|
||||||
|
insertFixmeDelStaged ha
|
||||||
|
|
||||||
|
modify_ :: FixmePerks m => Text -> String -> String -> FixmeM m ()
|
||||||
|
modify_ txt a b = do
|
||||||
|
acts <- asks fixmeEnvUpdateActions >>= readTVarIO
|
||||||
|
void $ runMaybeT do
|
||||||
|
ha <- toMPlus =<< lift (selectFixmeHash txt)
|
||||||
|
lift $ insertFixmeModStaged ha (fromString a) (fromString b)
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,9 @@ pattern TimeStampLike e <- (tsFromFromSyn -> Just e)
|
||||||
class MkId a where
|
class MkId a where
|
||||||
mkId :: a -> Id
|
mkId :: a -> Id
|
||||||
|
|
||||||
|
instance MkId String where
|
||||||
|
mkId s = fromString s
|
||||||
|
|
||||||
instance MkId FixmeAttrName where
|
instance MkId FixmeAttrName where
|
||||||
mkId (k :: FixmeAttrName) = Id ("$" <> coerce k)
|
mkId (k :: FixmeAttrName) = Id ("$" <> coerce k)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue