Skip to content

Commit

Permalink
completed help message
Browse files Browse the repository at this point in the history
  • Loading branch information
gutjuri committed Oct 18, 2020
1 parent c97e910 commit b231f25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tldr
# fast-tldr

A fast client for tldr.

Expand All @@ -13,7 +13,8 @@ See Github releases: https://github.com/gutjuri/fast-tldr/releases
Or

1. [Install stack](https://docs.haskellstack.org/en/stable/README/#how-to-install)
2. `stack install tldr`
2. `git clone https://github.com/gutjuri/fast-tldr.git && cd fast-tldr`
2. `stack install`

## Usage

Expand Down
2 changes: 1 addition & 1 deletion src/Tldr/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ parseOpts [] = ViewPage (ViewOptions Nothing Nothing Nothing) []
appMain :: IO ()
appMain = do
args <- getArgs
let opts = if null args then ShowHelp 1 else parseOpts args
let opts = parseOpts args
handleTldrOpts opts
3 changes: 3 additions & 0 deletions src/Tldr/App/Handler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ showHelp exitCode = do
, "-u --update Update local cache"
, "-L --language <lang> Use <lang> instead of english"
, "-p --platform <platform> Use <platform> instead of the native platform"
, "-a --auto-update-interval <days>"
, " Perform an automatic update if the cache is older than <days>"
]
putStr helpMsg
if exitCode == 0 then exitSuccess else exitFailure
Expand All @@ -79,6 +81,7 @@ handleTldrOpts :: Command -> IO ()
handleTldrOpts command = case command of
UpdateIndex -> updateTldrPages
ShowHelp exitCode -> showHelp exitCode
ViewPage _ [] -> handleTldrOpts $ ShowHelp 1
ViewPage voptions pages -> do
shouldPerformUpdate <- updateNecessary command
when shouldPerformUpdate updateTldrPages
Expand Down

0 comments on commit b231f25

Please sign in to comment.