Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f250c67

Browse filesBrowse files
committed
Ability to install Dash docs from local archive
1 parent febde87 commit f250c67
Copy full SHA for f250c67

File tree

4 files changed

+48
-7
lines changed
Filter options

4 files changed

+48
-7
lines changed

‎package.yaml

Copy file name to clipboardExpand all lines: package.yaml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: doc-browser
2-
version: 0.6.2
2+
version: 0.6.3
33
author: Incomplete
44
maintainer: incomplete@aixon.co
5-
copyright: Incomplete 2018
5+
copyright: Incomplete 2018-2020
66
license: MPL-2.0
77
github: qwfy/doc-browser
88
synopsis: A documentation browser

‎src/Dash.hs

Copy file name to clipboardExpand all lines: src/Dash.hs
+13-2Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,16 @@ installMany configRoot collections downloadMethod = do
8989

9090
installOne :: ConfigRoot -> Doc.Collection -> Opt.DownloadMethod -> IO ()
9191
installOne configRoot collection downloadMethod = do
92-
report ["fetching information about", show collection]
93-
Location{locVersion=version, locUrl} <- getLocation collection
92+
report ["collecting information about", show collection]
93+
(version, locUrl) <- case downloadMethod of
94+
Opt.UseBuiltinDownloader -> do
95+
Location{locVersion=version, locUrl} <- getLocation collection
96+
return (version, locUrl)
97+
Opt.DownloadManually -> do
98+
Location{locVersion=version, locUrl} <- getLocation collection
99+
return (version, locUrl)
100+
Opt.UseLocalArchive localPath version ->
101+
return (version, localPath)
94102
docHome <- getDocHome configRoot collection version
95103
withTempDir (getConfigRoot configRoot) "temp-dash-" $ \tempDir -> do
96104
archivePath <-
@@ -115,6 +123,9 @@ installOne configRoot collection downloadMethod = do
115123
Right p ->
116124
return p
117125
getPath
126+
Opt.UseLocalArchive localPath _ -> do
127+
parseAbsFile localPath
128+
118129
report ["unpacking to", toFilePath tempDir]
119130
systemUnpackTgzInto archivePath tempDir
120131
subdir <- findDocsetDir tempDir

‎src/Opt.hs

Copy file name to clipboardExpand all lines: src/Opt.hs
+14-3Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ data Logging
4444
data DownloadMethod
4545
= UseBuiltinDownloader
4646
| DownloadManually
47+
| UseLocalArchive String Doc.Version
4748
deriving (Show)
4849

4950

@@ -152,9 +153,19 @@ installDashParser =
152153
( metavar "COLLECTION"
153154
<> help "Collection to install. --list-remote-dash will list available collections"
154155
))
155-
<*> flag UseBuiltinDownloader DownloadManually
156-
( long "download-manually"
157-
<> help "Print the URL of this docset to stdin, you download it manually to a path, and then paste that path into this program. Wondering why this option exist? Congratulations! You live in a free country")
156+
<*> (
157+
flag UseBuiltinDownloader DownloadManually
158+
( long "download-manually"
159+
<> help "Print the URL of this docset to stdin, you download it manually to a path, and then paste that path into this program. Wondering why this option exist? Congratulations! You live in a free country")
160+
<|> ( UseLocalArchive <$>
161+
strOption
162+
( long "local-archive"
163+
<> metavar "ABSOLUTE-PATH")
164+
<*> option auto
165+
( long "version"
166+
<> metavar "DOCSET-VERSION")
167+
)
168+
)
158169

159170
listInstalledDashParser :: Parser T
160171
listInstalledDashParser =

‎stack.yaml.lock

Copy file name to clipboard
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file was autogenerated by Stack.
2+
# You should not edit this file by hand.
3+
# For more information, please see the documentation at:
4+
# https://docs.haskellstack.org/en/stable/lock_files
5+
6+
packages:
7+
- completed:
8+
hackage: hsqml-0.3.5.1@sha256:f8b06c0e5def57362345bd39de63acf177dc666ceebae64b7720d62d3a4631b8,5202
9+
pantry-tree:
10+
size: 3160
11+
sha256: e85c53364989fb682e646435c4d7e144e69eee907c72225017e9118d7bcd7d14
12+
original:
13+
hackage: hsqml-0.3.5.1
14+
snapshots:
15+
- completed:
16+
size: 506659
17+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/11/3.yaml
18+
sha256: 4a02ab9386e5968c58529fdf79707ccd0ae1352c213e28a78ee9e0d836be1824
19+
original: lts-11.3

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.