Skip to content

Commit

Permalink
Merge pull request #25 from psibi/exit-code
Browse files Browse the repository at this point in the history
Client gives non zero exit status for non-existent pages
  • Loading branch information
psibi committed Aug 1, 2020
2 parents caf3d45 + d76618b commit 782cb36
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.7.1

* Client gives non zero exit status for non-existent pages.

# 0.7.0

* Make it obey --language (-L) option.
Expand Down
7 changes: 5 additions & 2 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import Data.List (intercalate)
import Data.Semigroup ((<>))
import qualified Data.Set as Set
import Data.Version (showVersion)
import System.IO (stdout)
import System.IO (stdout, stderr, hPutStrLn)
import Options.Applicative
import Paths_tldr (version)
import System.Directory
import System.Environment (getArgs, getExecutablePath, lookupEnv)
import System.Exit (exitFailure)
import System.FilePath
import System.Process.Typed
import Data.Char (toLower)
Expand Down Expand Up @@ -196,7 +197,9 @@ handleTldrOpts opts@TldrOpts {..} = do
Just path -> renderPage path stdout
Nothing -> do
if checkLocale locale
then putStrLn ("No tldr entry for " <> (intercalate " " pages))
then do
hPutStrLn stderr ("No tldr entry for " <> (intercalate " " pages))
exitFailure
else handleTldrOpts
(opts
{ tldrAction =
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: tldr
version: '0.7.0'
version: '0.7.1'
synopsis: Haskell tldr client
description: |
Haskell tldr client with support for viewing tldr pages. Has offline
Expand Down

0 comments on commit 782cb36

Please sign in to comment.