module Shrun.Configuration.Data.CommonLogging.KeyHideSwitch
  ( KeyHideSwitch (..),
  )
where

import Shrun.Configuration.Default (Default (def))
import Shrun.Prelude

-- | Type for determining if we use the command's key
-- for display, rather than the key itself.
data KeyHideSwitch
  = -- | Display the command's key, if it exists, rather
    -- than the key itself.
    KeyHideOff
  | -- | Display the command itself, not the key.
    KeyHideOn
  deriving stock (KeyHideSwitch
KeyHideSwitch -> KeyHideSwitch -> Bounded KeyHideSwitch
forall a. a -> a -> Bounded a
$cminBound :: KeyHideSwitch
minBound :: KeyHideSwitch
$cmaxBound :: KeyHideSwitch
maxBound :: KeyHideSwitch
Bounded, Int -> KeyHideSwitch
KeyHideSwitch -> Int
KeyHideSwitch -> [KeyHideSwitch]
KeyHideSwitch -> KeyHideSwitch
KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
(KeyHideSwitch -> KeyHideSwitch)
-> (KeyHideSwitch -> KeyHideSwitch)
-> (Int -> KeyHideSwitch)
-> (KeyHideSwitch -> Int)
-> (KeyHideSwitch -> [KeyHideSwitch])
-> (KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch])
-> (KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch])
-> (KeyHideSwitch
    -> KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch])
-> Enum KeyHideSwitch
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: KeyHideSwitch -> KeyHideSwitch
succ :: KeyHideSwitch -> KeyHideSwitch
$cpred :: KeyHideSwitch -> KeyHideSwitch
pred :: KeyHideSwitch -> KeyHideSwitch
$ctoEnum :: Int -> KeyHideSwitch
toEnum :: Int -> KeyHideSwitch
$cfromEnum :: KeyHideSwitch -> Int
fromEnum :: KeyHideSwitch -> Int
$cenumFrom :: KeyHideSwitch -> [KeyHideSwitch]
enumFrom :: KeyHideSwitch -> [KeyHideSwitch]
$cenumFromThen :: KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
enumFromThen :: KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
$cenumFromTo :: KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
enumFromTo :: KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
$cenumFromThenTo :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
enumFromThenTo :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
Enum, KeyHideSwitch -> KeyHideSwitch -> Bool
(KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool) -> Eq KeyHideSwitch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: KeyHideSwitch -> KeyHideSwitch -> Bool
== :: KeyHideSwitch -> KeyHideSwitch -> Bool
$c/= :: KeyHideSwitch -> KeyHideSwitch -> Bool
/= :: KeyHideSwitch -> KeyHideSwitch -> Bool
Eq, Eq KeyHideSwitch
Eq KeyHideSwitch =>
(KeyHideSwitch -> KeyHideSwitch -> Ordering)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch)
-> (KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch)
-> Ord KeyHideSwitch
KeyHideSwitch -> KeyHideSwitch -> Bool
KeyHideSwitch -> KeyHideSwitch -> Ordering
KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: KeyHideSwitch -> KeyHideSwitch -> Ordering
compare :: KeyHideSwitch -> KeyHideSwitch -> Ordering
$c< :: KeyHideSwitch -> KeyHideSwitch -> Bool
< :: KeyHideSwitch -> KeyHideSwitch -> Bool
$c<= :: KeyHideSwitch -> KeyHideSwitch -> Bool
<= :: KeyHideSwitch -> KeyHideSwitch -> Bool
$c> :: KeyHideSwitch -> KeyHideSwitch -> Bool
> :: KeyHideSwitch -> KeyHideSwitch -> Bool
$c>= :: KeyHideSwitch -> KeyHideSwitch -> Bool
>= :: KeyHideSwitch -> KeyHideSwitch -> Bool
$cmax :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
max :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
$cmin :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
min :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
Ord, Int -> KeyHideSwitch -> ShowS
[KeyHideSwitch] -> ShowS
KeyHideSwitch -> [Char]
(Int -> KeyHideSwitch -> ShowS)
-> (KeyHideSwitch -> [Char])
-> ([KeyHideSwitch] -> ShowS)
-> Show KeyHideSwitch
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> KeyHideSwitch -> ShowS
showsPrec :: Int -> KeyHideSwitch -> ShowS
$cshow :: KeyHideSwitch -> [Char]
show :: KeyHideSwitch -> [Char]
$cshowList :: [KeyHideSwitch] -> ShowS
showList :: [KeyHideSwitch] -> ShowS
Show)

instance DecodeTOML KeyHideSwitch where
  tomlDecoder :: Decoder KeyHideSwitch
tomlDecoder =
    Decoder Bool
forall a. DecodeTOML a => Decoder a
tomlDecoder Decoder Bool -> (Bool -> KeyHideSwitch) -> Decoder KeyHideSwitch
forall (f :: Type -> Type) a b. Functor f => f a -> (a -> b) -> f b
<&> \case
      Bool
True -> KeyHideSwitch
KeyHideOn
      Bool
False -> KeyHideSwitch
KeyHideOff

instance Default KeyHideSwitch where
  def :: KeyHideSwitch
def = KeyHideSwitch
KeyHideOff