OILS / doctools / search_index.ysh View on Github | oils.pub

29 lines, 19 significant
1#!/usr/bin/env ysh
2
3# Usage:
4#
5# $0 index
6
7proc index-all(...files;; baseDir) {
8 for file in (files) {
9 echo Indexing $file >&2
10 doctools/search_index.py --base-dir $baseDir $file
11 }
12}
13
14proc parse-jsonl(; place) {
15 var index = []
16 for line in (io.stdin) {
17 var parsed = fromJson(line)
18 call index->extend(parsed)
19 }
20
21 call place->setValue(index)
22}
23
24proc index() {
25 index-all _release/VERSION/doc/{*,ref/*}.html (baseDir='_release/VERSION') | parse-jsonl (&indices)
26 json write (indices) > _release/VERSION/index.json
27}
28
29runproc @ARGV