Skip to content

Commit 782cb36

Browse files
authored
Merge pull request #25 from psibi/exit-code
Client gives non zero exit status for non-existent pages
2 parents caf3d45 + d76618b commit 782cb36

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.7.1
2+
3+
* Client gives non zero exit status for non-existent pages.
4+
15
# 0.7.0
26

37
* Make it obey --language (-L) option.

app/Main.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import Data.List (intercalate)
1111
import Data.Semigroup ((<>))
1212
import qualified Data.Set as Set
1313
import Data.Version (showVersion)
14-
import System.IO (stdout)
14+
import System.IO (stdout, stderr, hPutStrLn)
1515
import Options.Applicative
1616
import Paths_tldr (version)
1717
import System.Directory
1818
import System.Environment (getArgs, getExecutablePath, lookupEnv)
19+
import System.Exit (exitFailure)
1920
import System.FilePath
2021
import System.Process.Typed
2122
import Data.Char (toLower)
@@ -196,7 +197,9 @@ handleTldrOpts opts@TldrOpts {..} = do
196197
Just path -> renderPage path stdout
197198
Nothing -> do
198199
if checkLocale locale
199-
then putStrLn ("No tldr entry for " <> (intercalate " " pages))
200+
then do
201+
hPutStrLn stderr ("No tldr entry for " <> (intercalate " " pages))
202+
exitFailure
200203
else handleTldrOpts
201204
(opts
202205
{ tldrAction =

package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: tldr
2-
version: '0.7.0'
2+
version: '0.7.1'
33
synopsis: Haskell tldr client
44
description: |
55
Haskell tldr client with support for viewing tldr pages. Has offline

0 commit comments

Comments
 (0)