Skip to content

Commit

Permalink
Fixes eager cloning (See #8)
Browse files Browse the repository at this point in the history
It also fixes #7 in a more sane way.
  • Loading branch information
psibi committed Jan 12, 2018
1 parent 48856a5 commit a68ab33
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,12 @@ main :: IO ()
main = do
args <- getArgs
case execParserPure (prefs noBacktrack) tldrParserInfo args of
Failure _
| null args -> withArgs ["--help"] (execParser tldrParserInfo) >> return ()
failOpts@(Failure _)
| args == ["--update"] -> updateTldrPages
(parseResult :: ParserResult TldrOpts) -> do
case args of
["--help"] -> handleParseResult . Failure $ parserFailure defaultPrefs tldrParserInfo ShowHelpText mempty
_ -> do
initializeTldrPages
opts <- handleParseResult parseResult
let page = pageName opts
fname <- getPagePath page
maybe (putStrLn ("No tldr entry for " <> page)) renderPage fname
| otherwise -> handleParseResult failOpts >> return ()
Success opts -> do
initializeTldrPages
let page = pageName opts
fname <- getPagePath page
maybe (putStrLn ("No tldr entry for " <> page)) renderPage fname
_ -> return ()

0 comments on commit a68ab33

Please sign in to comment.