diff --git a/.fixme-new/config b/.fixme-new/config index c7b04870..da5db46d 100644 --- a/.fixme-new/config +++ b/.fixme-new/config @@ -28,3 +28,27 @@ fixme-file-comments "*.scm" ";" fixme-comments ";" "--" +(define-template short + (quot + (simple + (trim 10 $fixme-key) " " + + (if (~ FIXME $fixme-tag) + (then (fgd red (align 6 $fixme-tag)) ) + (else (if (~ TODO $fixme-tag) + (then (fgd green (align 6 $fixme-tag))) + (else (align 6 $fixme-tag)) ) ) + ) + + + (align 10 ("[" $workflow "]")) " " + (align 8 $type) " " + (align 12 $assigned) " " + (align 20 (trim 20 $committer-name)) " " + (trim 50 ($fixme-title)) " " + (nl)) + ) +) + +(set-template default short) + diff --git a/fixme-new/lib/Fixme/Run.hs b/fixme-new/lib/Fixme/Run.hs index 18e11177..43e19483 100644 --- a/fixme-new/lib/Fixme/Run.hs +++ b/fixme-new/lib/Fixme/Run.hs @@ -204,13 +204,14 @@ runTop forms = do _ -> throwIO $ BadFormException @C nil + entry $ bindMatch "report" $ nil_ \case + [] -> lift $ list_ Nothing () - -- ListVal (SymbolVal "list" : (Template n [])) -> do - -- debug $ "list" <+> pretty n - -- list_ n () + (SymbolVal "--template" : StringLike name : query) -> do + lift $ list_ (Just (fromString name)) query - entry $ bindMatch "report" $ nil_ $ const $ do - lift $ list_ Nothing () + query -> do + lift $ list_ mzero query entry $ bindMatch "env:show" $ nil_ $ const $ do lift printEnv @@ -257,6 +258,23 @@ runTop forms = do entry $ bindMatch "init" $ nil_ $ const $ do lift init + entry $ bindMatch "set-template" $ nil_ \case + [SymbolVal who, SymbolVal w] -> do + templates <- lift $ asks fixmeEnvTemplates + t <- readTVarIO templates + for_ (HM.lookup w t) $ \tpl -> do + atomically $ modifyTVar templates (HM.insert who tpl) + + _ -> throwIO $ BadFormException @C nil + + entry $ bindMatch "define-template" $ nil_ $ \case + [SymbolVal who, IsSimpleTemplate body ] -> do + -- notice $ red "define-template" <+> pretty who <+> pretty what + t <- lift $ asks fixmeEnvTemplates + atomically $ modifyTVar t (HM.insert who (Simple (SimpleTemplate body))) + + _ -> throwIO $ BadFormException @C nil + conf <- readConfig run dict (conf <> forms) >>= eatNil display diff --git a/fixme-new/lib/Fixme/Run/Internal.hs b/fixme-new/lib/Fixme/Run/Internal.hs index fd4dba8c..97cd2961 100644 --- a/fixme-new/lib/Fixme/Run/Internal.hs +++ b/fixme-new/lib/Fixme/Run/Internal.hs @@ -1,3 +1,5 @@ +{-# Language PatternSynonyms #-} +{-# Language ViewPatterns #-} module Fixme.Run.Internal where import Prelude hiding (init) @@ -48,6 +50,8 @@ import System.IO qualified as IO import Streaming.Prelude qualified as S +pattern IsSimpleTemplate :: forall {c} . [Syntax c] -> Syntax c +pattern IsSimpleTemplate xs <- ListVal (SymbolVal "simple" : xs) defaultTemplate :: HashMap Id FixmeTemplate defaultTemplate = HM.fromList [ ("default", Simple (SimpleTemplate short)) ]