Source codeContentsIndex
Hledger.Cli.Commands.Vty
Description
A simple text UI for hledger, based on the vty library.
Synopsis
data AppState = AppState {
av :: Vty
aw :: Int
ah :: Int
amsg :: String
aopts :: [Opt]
aargs :: [String]
ajournal :: Journal
abuf :: [String]
alocs :: [Loc]
}
data Loc = Loc {
scr :: Screen
sy :: Int
cy :: Int
largs :: [String]
}
data Screen
= BalanceScreen
| RegisterScreen
| PrintScreen
vty :: [Opt] -> [String] -> Journal -> IO ()
go :: AppState -> IO ()
pageHeight :: AppState -> Int
setLocScrollY :: Int -> Loc -> Loc
setLocCursorY :: Int -> Loc -> Loc
scrollY :: AppState -> Int
posY :: AppState -> Int
cursorY :: AppState -> Int
setScrollY :: Int -> AppState -> AppState
setPosY :: Int -> AppState -> AppState
setCursorY :: Int -> AppState -> AppState
updateScrollY :: (Int -> Int) -> AppState -> AppState
updatePosY :: (Int -> Int) -> AppState -> AppState
updateCursorY :: (Int -> Int) -> AppState -> AppState
resize :: Int -> Int -> AppState -> AppState
moveToTop :: AppState -> AppState
moveToBottom :: AppState -> AppState
moveUpAndPushEdge :: AppState -> AppState
moveDownAndPushEdge :: AppState -> AppState
nextpage :: AppState -> AppState
prevpage :: AppState -> AppState
pushLoc :: Loc -> AppState -> AppState
popLoc :: AppState -> AppState
clearLocs :: AppState -> AppState
exit :: AppState -> AppState
loc :: AppState -> Loc
currentArgs :: AppState -> [String]
screen :: AppState -> Screen
enter :: LocalTime -> Screen -> [String] -> AppState -> AppState
resetTrailAndEnter :: LocalTime -> Screen -> AppState -> AppState
updateData :: LocalTime -> AppState -> AppState
backout :: LocalTime -> AppState -> AppState
drilldown :: LocalTime -> AppState -> AppState
currentAccountName :: AppState -> AccountName
accountNameAt :: [String] -> Int -> AccountName
scrollToTransaction :: Maybe Transaction -> AppState -> AppState
currentTransaction :: AppState -> Maybe Transaction
renderScreen :: AppState -> Picture
padClipString :: Int -> Int -> String -> [String]
renderString :: Attr -> String -> Image
renderStatus :: Int -> String -> Image
data UITheme
= Restrained
| Colorful
| Blood
Documentation
data AppState Source
The application state when running the vty command.
Constructors
AppState
av :: Vtythe vty context
aw :: Intwindow width
ah :: Intwindow height
amsg :: Stringstatus message
aopts :: [Opt]command-line opts
aargs :: [String]command-line args at startup
ajournal :: Journalparsed journal
abuf :: [String]lines of the current buffered view
alocs :: [Loc]user's navigation trail within the UI ^ never null, head is current location
show/hide Instances
data Loc Source
A location within the user interface.
Constructors
Loc
scr :: Screenone of the available screens
sy :: Intviewport y scroll position
cy :: Intcursor y position
largs :: [String]command-line args, possibly narrowed for this location
show/hide Instances
Show Loc
data Screen Source
The screens available within the user interface.
Constructors
BalanceScreenlike hledger balance, shows accounts
RegisterScreenlike hledger register, shows transaction-postings
PrintScreenlike hledger print, shows journal transactions | LedgerScreen -- ^ shows the raw journal
show/hide Instances
Eq Screen
Show Screen
vty :: [Opt] -> [String] -> Journal -> IO ()Source
Run the vty (curses-style) ui.
go :: AppState -> IO ()Source
Update the screen, wait for the next event, repeat.
pageHeight :: AppState -> IntSource
The number of lines currently available for the main data display area.
setLocScrollY :: Int -> Loc -> LocSource
setLocCursorY :: Int -> Loc -> LocSource
scrollY :: AppState -> IntSource
posY :: AppState -> IntSource
cursorY :: AppState -> IntSource
setScrollY :: Int -> AppState -> AppStateSource
setPosY :: Int -> AppState -> AppStateSource
setCursorY :: Int -> AppState -> AppStateSource
updateScrollY :: (Int -> Int) -> AppState -> AppStateSource
updatePosY :: (Int -> Int) -> AppState -> AppStateSource
updateCursorY :: (Int -> Int) -> AppState -> AppStateSource
resize :: Int -> Int -> AppState -> AppStateSource
moveToTop :: AppState -> AppStateSource
moveToBottom :: AppState -> AppStateSource
moveUpAndPushEdge :: AppState -> AppStateSource
moveDownAndPushEdge :: AppState -> AppStateSource
nextpage :: AppState -> AppStateSource
Scroll down by page height or until we can just see the last line, without moving the cursor, or if we are already scrolled as far as possible then move the cursor to the last line.
prevpage :: AppState -> AppStateSource
Scroll up by page height or until we can just see the first line, without moving the cursor, or if we are scrolled as far as possible then move the cursor to the first line.
pushLoc :: Loc -> AppState -> AppStateSource
Push a new UI location on to the stack.
popLoc :: AppState -> AppStateSource
clearLocs :: AppState -> AppStateSource
exit :: AppState -> AppStateSource
loc :: AppState -> LocSource
currentArgs :: AppState -> [String]Source
Get the filter pattern args in effect for the current ui location.
screen :: AppState -> ScreenSource
enter :: LocalTime -> Screen -> [String] -> AppState -> AppStateSource
Enter a new screen, with possibly new args, adding the new ui location to the stack.
resetTrailAndEnter :: LocalTime -> Screen -> AppState -> AppStateSource
updateData :: LocalTime -> AppState -> AppStateSource
Regenerate the display data appropriate for the current screen.
backout :: LocalTime -> AppState -> AppStateSource
drilldown :: LocalTime -> AppState -> AppStateSource
currentAccountName :: AppState -> AccountNameSource
Get the account name currently highlighted by the cursor on the balance screen. Results undefined while on other screens.
accountNameAt :: [String] -> Int -> AccountNameSource
Get the full name of the account being displayed at a specific line within the balance command's output.
scrollToTransaction :: Maybe Transaction -> AppState -> AppStateSource
If on the print screen, move the cursor to highlight the specified entry (or a reasonable guess). Doesn't work.
currentTransaction :: AppState -> Maybe TransactionSource
Get the transaction containing the posting currently highlighted by the cursor on the register screen (or best guess). Results undefined while on other screens.
renderScreen :: AppState -> PictureSource
padClipString :: Int -> Int -> String -> [String]Source
renderString :: Attr -> String -> ImageSource
renderStatus :: Int -> String -> ImageSource
data UITheme Source
Constructors
Restrained
Colorful
Blood
Produced by Haddock version 2.6.1