ui: the A key runs hledger-iadd (if available)
This commit is contained in:
parent
7483be02fa
commit
31e4f538c0
@ -299,6 +299,7 @@ asHandle ui0@UIState{
|
||||
liftIO (uiReloadJournal copts d ui) >>= continue
|
||||
VtyEvent (EvKey (KChar 'I') []) -> continue $ uiCheckBalanceAssertions d (toggleIgnoreBalanceAssertions ui)
|
||||
VtyEvent (EvKey (KChar 'a') []) -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> uiReloadJournalIfChanged copts d j ui
|
||||
VtyEvent (EvKey (KChar 'A') []) -> suspendAndResume $ void (runIadd (journalFilePath j)) >> uiReloadJournalIfChanged copts d j ui
|
||||
VtyEvent (EvKey (KChar 'E') []) -> suspendAndResume $ void (runEditor endPos (journalFilePath j)) >> uiReloadJournalIfChanged copts d j ui
|
||||
VtyEvent (EvKey (KChar '0') []) -> continue $ regenerateScreens j d $ setDepth (Just 0) ui
|
||||
VtyEvent (EvKey (KChar '1') []) -> continue $ regenerateScreens j d $ setDepth (Just 1) ui
|
||||
|
||||
@ -26,6 +26,11 @@ type TextPosition = (Int, Maybe Int)
|
||||
endPos :: Maybe TextPosition
|
||||
endPos = Just (-1,Nothing)
|
||||
|
||||
-- | Run the hledger-iadd executable (an alternative to the built-in add command),
|
||||
-- or raise an error.
|
||||
runIadd :: FilePath -> IO ExitCode
|
||||
runIadd f = runCommand ("hledger-iadd -f " ++ f) >>= waitForProcess
|
||||
|
||||
-- | Try running the user's preferred text editor, or a default edit command,
|
||||
-- on the main journal file, blocking until it exits, and returning the exit code;
|
||||
-- or raise an error.
|
||||
|
||||
@ -275,6 +275,7 @@ rsHandle ui@UIState{
|
||||
liftIO (uiReloadJournal copts d ui) >>= continue
|
||||
VtyEvent (EvKey (KChar 'I') []) -> continue $ uiCheckBalanceAssertions d (toggleIgnoreBalanceAssertions ui)
|
||||
VtyEvent (EvKey (KChar 'a') []) -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> uiReloadJournalIfChanged copts d j ui
|
||||
VtyEvent (EvKey (KChar 'A') []) -> suspendAndResume $ void (runIadd (journalFilePath j)) >> uiReloadJournalIfChanged copts d j ui
|
||||
VtyEvent (EvKey (KChar 't') []) -> continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui
|
||||
VtyEvent (EvKey (KChar 'E') []) -> suspendAndResume $ void (runEditor pos f) >> uiReloadJournalIfChanged copts d j ui
|
||||
where
|
||||
|
||||
@ -56,7 +56,8 @@ helpDialog =
|
||||
,str " "
|
||||
,str "MISC"
|
||||
,renderKey ("?", "toggle help")
|
||||
,renderKey ("a", "add transaction")
|
||||
,renderKey ("a", "add transaction (hledger add)")
|
||||
,renderKey ("A", "add transaction (hledger-iadd)")
|
||||
,renderKey ("E", "open editor")
|
||||
,renderKey ("g", "reload data")
|
||||
,renderKey ("I", "toggle balance assertions")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user