Skip to content

Commit 480f3bd

Browse files
authored
Add --no-patch flag to build-index command. (#22)
Add `--no-patch` flag to `build-index` command.
1 parent 363e001 commit 480f3bd

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ New features:
1212
- Show help for each CLI command (#17)
1313
- Add packages to the search index (#16)
1414
- Sort search results by popularity (based on number of package reverse dependencies).
15+
- Add `--no-patch` flag to `build-index` command.
1516

1617
Bugfixes:
1718
- Fix decoding of kind annotations in `forall`s (#17)

src/Docs/Search/IndexBuilder.purs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ import Node.Process as Process
4343
import Web.Bower.PackageMeta (PackageMeta(..))
4444

4545

46-
type Config = { docsFiles :: Array String
47-
, bowerFiles :: Array String
48-
, generatedDocs :: String
49-
}
46+
type Config =
47+
{ docsFiles :: Array String
48+
, bowerFiles :: Array String
49+
, generatedDocs :: String
50+
, noPatch :: Boolean
51+
}
5052

5153

5254
run :: Config -> Effect Unit
@@ -83,7 +85,9 @@ run' cfg = do
8385
ignore <$> parallel (writeIndex cfg index)
8486
<*> parallel (writeTypeIndex cfg typeIndex)
8587
<*> parallel (writePackageInfo packageInfo)
86-
<*> parallel (patchDocs cfg)
88+
<*> parallel (if cfg.noPatch
89+
then pure unit
90+
else patchDocs cfg)
8791
<*> parallel (copyAppFile cfg)
8892

8993
let countOfDefinitions = Trie.size $ unwrap index

src/Docs/Search/Main.purs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Data.Maybe (Maybe, fromMaybe, optional)
1414
import Data.Unfoldable (class Unfoldable)
1515
import Effect (Effect)
1616
import Effect.Console (log)
17-
import Options.Applicative (Parser, command, execParser, fullDesc, helper, info, long, metavar, progDesc, strOption, subparser, value, (<**>))
17+
import Options.Applicative (Parser, command, execParser, flag, fullDesc, help, helper, info, long, metavar, progDesc, strOption, subparser, value, (<**>))
1818
import Options.Applicative as CA
1919

2020

@@ -45,6 +45,7 @@ data Commands
4545
{ docsFiles :: Array String
4646
, bowerFiles :: Array String
4747
, generatedDocs :: String
48+
, noPatch :: Boolean
4849
}
4950
| Search
5051
{ docsFiles :: Array String
@@ -92,7 +93,12 @@ buildIndex = ado
9293
<> value "./generated-docs/"
9394
)
9495

95-
in BuildIndex { docsFiles, bowerFiles, generatedDocs }
96+
noPatch <- flag false true
97+
( long "no-patch"
98+
<> help "Do not patch the HTML docs, only build indices"
99+
)
100+
101+
in BuildIndex { docsFiles, bowerFiles, generatedDocs, noPatch }
96102

97103

98104
startInteractive :: Parser Commands

0 commit comments

Comments
 (0)