Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When updating the database, show the download location #30

Merged
merged 2 commits into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.8.1

* When pages are updated, the client now shows the download location.

# 0.8.0

* Split the library into more parts.
Expand Down
7 changes: 5 additions & 2 deletions src/Tldr/App/Handler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ updateTldrPages = do
let repoDir = dataDir </> "tldr"
repoExists <- doesDirectoryExist repoDir
if repoExists
then runProcess_ $
setWorkingDir repoDir $ proc "git" ["pull", "origin", "master"]
then do
putStrLn $ "Downloading tldr pages to " ++ repoDir
runProcess_ $
setWorkingDir repoDir $ proc "git" ["pull", "origin", "master"]
else initializeTldrPages

computeLocale :: Maybe String -> Locale
Expand Down Expand Up @@ -137,6 +139,7 @@ initializeTldrPages = do
unless initialized $ do
dataDir <- getXdgDirectory XdgData tldrDirName
createDirectoryIfMissing False dataDir
putStrLn $ "Initialising tldr page storage in " ++ dataDir
runProcess_ $ setWorkingDir dataDir $ proc "git" ["clone", repoHttpsUrl]

getCheckDirs :: ViewOptions -> [String]
Expand Down