diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-12-04 08:36:02 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-12-05 06:07:41 +0100 |
commit | 1b1c3faabae530229eb675a2e70e744c2f45cbbe (patch) | |
tree | acc3e8eede9053fb5e639deeb553aa600c994598 /app/History/CommitHash.hs | |
parent | 3a76b6f0fc0c9c23000dd82870922c885c34ffa6 (diff) |
feat: add experimental render api
Diffstat (limited to 'app/History/CommitHash.hs')
-rw-r--r-- | app/History/CommitHash.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/History/CommitHash.hs b/app/History/CommitHash.hs index f1b8283..cbe4db1 100644 --- a/app/History/CommitHash.hs +++ b/app/History/CommitHash.hs @@ -8,6 +8,7 @@ where import Data.Binary (Binary) import Data.Text qualified as T import GHC.Generics (Generic) +import Render qualified as P data CommitHash = WorkingTree @@ -21,3 +22,16 @@ toShortText (Commit hash) = T.take 7 hash toText :: CommitHash -> T.Text toText WorkingTree = "<dirty>" toText (Commit hash) = hash + +instance P.Render CommitHash where + render = P.render . P.Detailed + +instance P.Render (P.Detailed CommitHash) where + render (P.Detailed commitHash) = + P.styled [P.color P.Yellow] $ + P.render (toText commitHash) + +instance P.Render (P.Summarized CommitHash) where + render (P.Summarized commitHash) = + P.styled [P.color P.Yellow] $ + P.render (toShortText commitHash) |