rename the ui command to vty for consistency
This commit is contained in:
parent
70576e87d1
commit
c50c66ff14
@ -16,7 +16,7 @@ module Hledger.Cli.Commands.All (
|
|||||||
module Hledger.Cli.Commands.Register,
|
module Hledger.Cli.Commands.Register,
|
||||||
module Hledger.Cli.Commands.Stats,
|
module Hledger.Cli.Commands.Stats,
|
||||||
#ifdef VTY
|
#ifdef VTY
|
||||||
module Hledger.Cli.Commands.UI,
|
module Hledger.Cli.Commands.Vty,
|
||||||
#endif
|
#endif
|
||||||
#if defined(WEB) || defined(WEBHAPPSTACK)
|
#if defined(WEB) || defined(WEBHAPPSTACK)
|
||||||
module Hledger.Cli.Commands.Web,
|
module Hledger.Cli.Commands.Web,
|
||||||
@ -35,7 +35,7 @@ import Hledger.Cli.Commands.Print
|
|||||||
import Hledger.Cli.Commands.Register
|
import Hledger.Cli.Commands.Register
|
||||||
import Hledger.Cli.Commands.Stats
|
import Hledger.Cli.Commands.Stats
|
||||||
#ifdef VTY
|
#ifdef VTY
|
||||||
import Hledger.Cli.Commands.UI
|
import Hledger.Cli.Commands.Vty
|
||||||
#endif
|
#endif
|
||||||
#if defined(WEB) || defined(WEBHAPPSTACK)
|
#if defined(WEB) || defined(WEBHAPPSTACK)
|
||||||
import Hledger.Cli.Commands.Web
|
import Hledger.Cli.Commands.Web
|
||||||
@ -57,7 +57,7 @@ tests_Hledger_Commands = TestList
|
|||||||
-- ,Hledger.Cli.Commands.Stats.tests_Stats
|
-- ,Hledger.Cli.Commands.Stats.tests_Stats
|
||||||
]
|
]
|
||||||
-- #ifdef VTY
|
-- #ifdef VTY
|
||||||
-- ,Hledger.Cli.Commands.UI.tests_UI
|
-- ,Hledger.Cli.Commands.Vty.tests_Vty
|
||||||
-- #endif
|
-- #endif
|
||||||
-- #if defined(WEB) || defined(WEBHAPPSTACK)
|
-- #if defined(WEB) || defined(WEBHAPPSTACK)
|
||||||
-- ,Hledger.Cli.Commands.Web.tests_Web
|
-- ,Hledger.Cli.Commands.Web.tests_Web
|
||||||
|
|||||||
@ -4,7 +4,7 @@ A simple text UI for hledger, based on the vty library.
|
|||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
module Hledger.Cli.Commands.UI
|
module Hledger.Cli.Commands.Vty
|
||||||
where
|
where
|
||||||
import Safe (headDef)
|
import Safe (headDef)
|
||||||
import Graphics.Vty
|
import Graphics.Vty
|
||||||
@ -19,7 +19,7 @@ helpmsg = "(b)alance, (r)egister, (p)rint, (right) to drill down, (left) to back
|
|||||||
|
|
||||||
instance Show Vty where show = const "a Vty"
|
instance Show Vty where show = const "a Vty"
|
||||||
|
|
||||||
-- | The application state when running the ui command.
|
-- | The application state when running the vty command.
|
||||||
data AppState = AppState {
|
data AppState = AppState {
|
||||||
av :: Vty -- ^ the vty context
|
av :: Vty -- ^ the vty context
|
||||||
,aw :: Int -- ^ window width
|
,aw :: Int -- ^ window width
|
||||||
@ -47,9 +47,9 @@ data Screen = BalanceScreen -- ^ like hledger balance, shows accounts
|
|||||||
-- | LedgerScreen -- ^ shows the raw ledger
|
-- | LedgerScreen -- ^ shows the raw ledger
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
||||||
-- | Run the interactive text ui.
|
-- | Run the vty (curses-style) ui.
|
||||||
ui :: [Opt] -> [String] -> Ledger -> IO ()
|
vty :: [Opt] -> [String] -> Ledger -> IO ()
|
||||||
ui opts args l = do
|
vty opts args l = do
|
||||||
v <- mkVty
|
v <- mkVty
|
||||||
DisplayRegion w h <- display_bounds $ terminal v
|
DisplayRegion w h <- display_bounds $ terminal v
|
||||||
let opts' = SubTotal:opts
|
let opts' = SubTotal:opts
|
||||||
@ -35,7 +35,7 @@ main = do
|
|||||||
| cmd `isPrefixOf` "add" = withLedgerDo opts args cmd add
|
| cmd `isPrefixOf` "add" = withLedgerDo opts args cmd add
|
||||||
| cmd `isPrefixOf` "stats" = withLedgerDo opts args cmd stats
|
| cmd `isPrefixOf` "stats" = withLedgerDo opts args cmd stats
|
||||||
#ifdef VTY
|
#ifdef VTY
|
||||||
| cmd `isPrefixOf` "ui" = withLedgerDo opts args cmd ui
|
| cmd `isPrefixOf` "vty" = withLedgerDo opts args cmd vty
|
||||||
#endif
|
#endif
|
||||||
#if defined(WEB) || defined(WEBHAPPSTACK)
|
#if defined(WEB) || defined(WEBHAPPSTACK)
|
||||||
| cmd `isPrefixOf` "web" = withLedgerDo opts args cmd web
|
| cmd `isPrefixOf` "web" = withLedgerDo opts args cmd web
|
||||||
|
|||||||
@ -88,7 +88,7 @@ executable hledger
|
|||||||
|
|
||||||
if flag(vty)
|
if flag(vty)
|
||||||
cpp-options: -DVTY
|
cpp-options: -DVTY
|
||||||
other-modules:Hledger.Cli.Commands.UI
|
other-modules:Hledger.Cli.Commands.Vty
|
||||||
build-depends:
|
build-depends:
|
||||||
vty >= 4.0.0.1
|
vty >= 4.0.0.1
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ library
|
|||||||
|
|
||||||
if flag(vty)
|
if flag(vty)
|
||||||
cpp-options: -DVTY
|
cpp-options: -DVTY
|
||||||
exposed-modules:Hledger.Cli.Commands.UI
|
exposed-modules:Hledger.Cli.Commands.Vty
|
||||||
build-depends:
|
build-depends:
|
||||||
vty >= 4.0.0.1
|
vty >= 4.0.0.1
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user