dev: lens: Introduce lenses for CliOpts.
This commit is contained in:
parent
f3eacebc1d
commit
bd113b223f
@ -5,7 +5,13 @@ related utilities used by hledger commands.
|
||||
|
||||
-}
|
||||
|
||||
{-# LANGUAGE CPP, ScopedTypeVariables, FlexibleContexts, TypeFamilies, OverloadedStrings, PackageImports #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE PackageImports #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE TypeFamilies #-}
|
||||
|
||||
module Hledger.Cli.CliOptions (
|
||||
|
||||
@ -35,6 +41,7 @@ module Hledger.Cli.CliOptions (
|
||||
|
||||
-- * CLI options
|
||||
CliOpts(..),
|
||||
HasCliOpts(..),
|
||||
defcliopts,
|
||||
getHledgerCliOpts,
|
||||
getHledgerCliOpts',
|
||||
@ -747,3 +754,22 @@ getDirectoryContentsSafe d =
|
||||
-- putStrLn $ "processed opts:\n" ++ show opts
|
||||
-- d <- getCurrentDay
|
||||
-- putStrLn $ "search query: " ++ (show $ queryFromOpts d $ reportopts_ opts)
|
||||
|
||||
-- ** Lenses
|
||||
|
||||
makeHledgerClassyLenses ''CliOpts
|
||||
|
||||
instance HasInputOpts CliOpts where
|
||||
inputOpts = inputopts
|
||||
|
||||
instance HasBalancingOpts CliOpts where
|
||||
balancingOpts = inputOpts.balancingOpts
|
||||
|
||||
instance HasReportSpec CliOpts where
|
||||
reportSpec = reportspec
|
||||
|
||||
instance HasReportOptsNoUpdate CliOpts where
|
||||
reportOptsNoUpdate = reportSpec.reportOptsNoUpdate
|
||||
|
||||
instance HasReportOpts CliOpts where
|
||||
reportOpts = reportSpec.reportOpts
|
||||
|
||||
@ -158,6 +158,7 @@ library
|
||||
, lucid
|
||||
, math-functions >=0.3.3.0
|
||||
, megaparsec >=7.0.0 && <9.2
|
||||
, microlens >=0.4
|
||||
, mtl >=2.2.1
|
||||
, process
|
||||
, regex-tdfa
|
||||
@ -207,6 +208,7 @@ executable hledger
|
||||
, hledger-lib >=1.22.99 && <1.23
|
||||
, math-functions >=0.3.3.0
|
||||
, megaparsec >=7.0.0 && <9.2
|
||||
, microlens >=0.4
|
||||
, mtl >=2.2.1
|
||||
, process
|
||||
, regex-tdfa
|
||||
@ -257,6 +259,7 @@ test-suite unittest
|
||||
, hledger-lib >=1.22.99 && <1.23
|
||||
, math-functions >=0.3.3.0
|
||||
, megaparsec >=7.0.0 && <9.2
|
||||
, microlens >=0.4
|
||||
, mtl >=2.2.1
|
||||
, process
|
||||
, regex-tdfa
|
||||
@ -306,6 +309,7 @@ benchmark bench
|
||||
, html
|
||||
, math-functions >=0.3.3.0
|
||||
, megaparsec >=7.0.0 && <9.2
|
||||
, microlens >=0.4
|
||||
, mtl >=2.2.1
|
||||
, process
|
||||
, regex-tdfa
|
||||
|
||||
@ -112,6 +112,7 @@ dependencies:
|
||||
- githash >=0.1.4
|
||||
- haskeline >=0.6
|
||||
- megaparsec >=7.0.0 && <9.2
|
||||
- microlens >=0.4
|
||||
- mtl >=2.2.1
|
||||
- process
|
||||
- regex-tdfa
|
||||
|
||||
Loading…
Reference in New Issue
Block a user