never executed always true always false
    1 {-# LANGUAGE FlexibleContexts #-}
    2 {-# LANGUAGE LambdaCase #-}
    3 
    4 {-# OPTIONS_HADDOCK hide #-}
    5 
    6 module Command.Address
    7     ( Cmd
    8     , mod
    9     , run
   10     ) where
   11 
   12 import Options.Applicative
   13     ( CommandFields
   14     , Mod
   15     , command
   16     , footerDoc
   17     , helper
   18     , info
   19     , progDesc
   20     , subparser
   21     )
   22 import Options.Applicative.Help.Pretty
   23     ( bold, hsep, string, vsep )
   24 import Prelude hiding
   25     ( mod )
   26 
   27 import qualified Command.Address.Bootstrap as Bootstrap
   28 import qualified Command.Address.Delegation as Delegation
   29 import qualified Command.Address.Inspect as Inspect
   30 import qualified Command.Address.Payment as Payment
   31 import qualified Command.Address.Pointer as Pointer
   32 import qualified Command.Address.Reward as Reward
   33 
   34 
   35 data Cmd
   36     = Bootstrap Bootstrap.Cmd
   37     | Payment Payment.Cmd
   38     | Reward Reward.Cmd
   39     | Delegation Delegation.Cmd
   40     | Pointer Pointer.Cmd
   41     | Inspect Inspect.Cmd
   42     deriving (Show)
   43 
   44 mod :: (Cmd -> parent) -> Mod CommandFields parent
   45 mod liftCmd = command "address" $
   46     info (helper <*> fmap liftCmd parser) $ mempty
   47         <> progDesc "About addresses"
   48         <> footerDoc (Just $ vsep
   49             [ string "Integrating with Byron?"
   50             , hsep [ string "  ↳ Look at", bold $ string "'bootstrap'", string "." ]
   51             , string ""
   52             , string "Integrating with Shelley?"
   53             , hsep [ string "  ↳ Look at", bold $ string "'payment'", string "&", bold $ string "'delegation'", string "." ]
   54             ])
   55   where
   56     parser = subparser $ mconcat
   57         [ Bootstrap.mod Bootstrap
   58         , Payment.mod Payment
   59         , Reward.mod Reward
   60         , Delegation.mod Delegation
   61         , Pointer.mod Pointer
   62         , Inspect.mod Inspect
   63         ]
   64 
   65 run :: Cmd -> IO ()
   66 run = \case
   67     Bootstrap sub -> Bootstrap.run sub
   68     Payment sub -> Payment.run sub
   69     Reward sub -> Reward.run sub
   70     Delegation sub -> Delegation.run sub
   71     Pointer sub -> Pointer.run sub
   72     Inspect sub -> Inspect.run sub