diff options
author | Kierán Meinhardt <kieran.meinhardt@gmail.com> | 2020-10-06 22:47:33 +0200 |
---|---|---|
committer | Kierán Meinhardt <kieran.meinhardt@gmail.com> | 2020-10-06 22:53:52 +0200 |
commit | 3cf270753acc512ecf4333cbce2360a91546c5af (patch) | |
tree | d9654de9a3074a7971b9ee3b0a92294f6da6aad7 | |
parent | 28d80f4abc15d1e3d3b9e60d12836a0926bcd85a (diff) |
State: rename tagSymbols to aliases
-rw-r--r-- | config/kmein.hs | 2 | ||||
-rw-r--r-- | src/Much/Config.hs | 4 | ||||
-rw-r--r-- | src/Much/Core.hs | 2 | ||||
-rw-r--r-- | src/Much/RenderTreeView.hs | 2 | ||||
-rw-r--r-- | src/Much/State.hs | 5 |
5 files changed, 7 insertions, 8 deletions
diff --git a/config/kmein.hs b/config/kmein.hs index 91869a2..a5da7e1 100644 --- a/config/kmein.hs +++ b/config/kmein.hs @@ -60,7 +60,7 @@ main = , ("spam", pure [38,5,202]) ] } - , tagSymbols = + , aliases = [ ("flagged", "🔖") , ("attachment", "📎") , ("signed", "🔒") diff --git a/src/Much/Config.hs b/src/Much/Config.hs index 93037ed..36f06bf 100644 --- a/src/Much/Config.hs +++ b/src/Much/Config.hs @@ -10,9 +10,9 @@ import qualified Data.Map as M data Config = Config { colorConfig :: Maybe (ColorConfig Maybe) , query :: Maybe String - , tagSymbols :: Maybe (M.Map T.Text T.Text) + , aliases :: Maybe (M.Map T.Text T.Text) , attachmentOverwrite :: Maybe Bool , attachmentDirectory :: Maybe FilePath - } deriving (Generic, Show) + } deriving (Generic) instance FromJSON Config diff --git a/src/Much/Core.hs b/src/Much/Core.hs index d325959..2ce5ad7 100644 --- a/src/Much/Core.hs +++ b/src/Much/Core.hs @@ -36,7 +36,7 @@ import qualified System.Console.Terminal.Size as Term importConfig :: Config.Config -> State -> State importConfig config state = state - { tagSymbols = fromMaybe (tagSymbols state) (Config.tagSymbols config) + { aliases = fromMaybe (aliases state) (Config.aliases config) , query = fromMaybe (query state) (Config.query config) , attachmentDirectory = fromMaybe (attachmentDirectory state) (Config.attachmentDirectory config) , attachmentOverwrite = fromMaybe (attachmentOverwrite state) (Config.attachmentOverwrite config) diff --git a/src/Much/RenderTreeView.hs b/src/Much/RenderTreeView.hs index b4aadda..dc4d773 100644 --- a/src/Much/RenderTreeView.hs +++ b/src/Much/RenderTreeView.hs @@ -227,7 +227,7 @@ renderTag state tag = case M.lookup tag $ runIdentity $ tagMap $ colorConfig sta Just visual -> SGR (runIdentity visual) plain Nothing -> plain where - plain = Plain $ T.unpack $ fromMaybe tag $ M.lookup tag (tagSymbols state) + plain = Plain $ T.unpack $ fromMaybe tag $ M.lookup tag (aliases state) dropAddress :: String -> String diff --git a/src/Much/State.hs b/src/Much/State.hs index 620a489..a1de01f 100644 --- a/src/Much/State.hs +++ b/src/Much/State.hs @@ -34,7 +34,7 @@ data State = State , query :: String , keymap :: String -> State -> IO State , mousemap :: Scan -> State -> IO State - , tagSymbols :: M.Map T.Text T.Text + , aliases :: M.Map T.Text T.Text , colorConfig :: ColorConfig Identity , apiConfig :: Much.API.Config.Config , attachmentOverwrite :: Bool @@ -85,7 +85,6 @@ instance Applicative f => Default (ColorConfig f) where } instance FromJSON (ColorConfig Maybe) -instance Show (ColorConfig Maybe) instance Default State where def = State @@ -103,7 +102,7 @@ instance Default State where , keymap = const return , mousemap = const return , colorConfig = def - , tagSymbols = M.empty + , aliases = M.empty , apiConfig = def , attachmentOverwrite = False , attachmentDirectory = "/tmp" |