mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-19 10:17:35 +03:00
fix: make --tldr compatible with the tealdeer client also
This commit is contained in:
parent
1d7fdd423d
commit
4772001fe5
@ -147,15 +147,14 @@ tldr name = lookup name tldrs
|
||||
-- | Display one of the hledger tldr pages, using "tldr".
|
||||
runTldrForPage :: TldrPage -> IO ()
|
||||
runTldrForPage name =
|
||||
let tldrprog = "tldr" in
|
||||
case tldr name of
|
||||
Nothing -> error' $ "sorry, there's no " <> name <> " tldr page yet"
|
||||
Just b -> (do
|
||||
withSystemTempFile (name++".md") $ \f h -> do
|
||||
BC.hPutStrLn h b
|
||||
hClose h
|
||||
callCommand $ dbg1 "tldr command" $ unwords [tldrprog, "-r", f]
|
||||
callCommand $ dbg1 "tldr command" $ "tldr --render " <> f
|
||||
) `catch` (\(_e::IOException) -> do
|
||||
hPutStrLn stderr $ "Could not run " <> tldrprog <> ", using fallback viewer:\n"
|
||||
hPutStrLn stderr $ "Warning: could not run tldr, using fallback viewer instead.\n"
|
||||
BC.putStrLn b
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user