Debian Codegraph @

docs/justfile

raw
1 # justfile for libtmux documentation
2 # https://just.systems/
3
4 set shell := ["bash", "-uc"]
5
6 # Configuration
7 http_port := "8023"
8 builddir := "_build"
9 sphinxopts := ""
10 sphinxbuild := "uv run sphinx-build"
11 sourcedir := "."
12
13 # File patterns for watching
14 watch_files := "find .. -type f -not -path '*/\\.*' | grep -i '.*[.]\\(rst\\|md\\)$\\|.*[.]py$\\|CHANGES\\|TODO\\|.*conf\\.py' 2> /dev/null"
15
16 # Sphinx options
17 allsphinxopts := "-d " + builddir + "/doctrees " + sphinxopts + " ."
18
19 # List all available commands
20 default:
21 @just --list
22
23 # Build HTML documentation
24 [group: 'build']
25 html:
26 {{ sphinxbuild }} -b dirhtml {{ allsphinxopts }} {{ builddir }}/html
27 @echo ""
28 @echo "Build finished. The HTML pages are in {{ builddir }}/html."
29
30 # Build directory HTML files
31 [group: 'build']
32 dirhtml:
33 {{ sphinxbuild }} -b dirhtml {{ allsphinxopts }} {{ builddir }}/dirhtml
34 @echo ""
35 @echo "Build finished. The HTML pages are in {{ builddir }}/dirhtml."
36
37 # Build single HTML file
38 [group: 'build']
39 singlehtml:
40 {{ sphinxbuild }} -b singlehtml {{ allsphinxopts }} {{ builddir }}/singlehtml
41 @echo ""
42 @echo "Build finished. The HTML page is in {{ builddir }}/singlehtml."
43
44 # Build EPUB
45 [group: 'build']
46 epub:
47 {{ sphinxbuild }} -b epub {{ allsphinxopts }} {{ builddir }}/epub
48 @echo ""
49 @echo "Build finished. The epub file is in {{ builddir }}/epub."
50
51 # Build LaTeX files
52 [group: 'build']
53 latex:
54 {{ sphinxbuild }} -b latex {{ allsphinxopts }} {{ builddir }}/latex
55 @echo ""
56 @echo "Build finished; the LaTeX files are in {{ builddir }}/latex."
57
58 # Build PDF via LaTeX
59 [group: 'build']
60 latexpdf:
61 {{ sphinxbuild }} -b latex {{ allsphinxopts }} {{ builddir }}/latex
62 @echo "Running LaTeX files through pdflatex..."
63 make -C {{ builddir }}/latex all-pdf
64 @echo "pdflatex finished; the PDF files are in {{ builddir }}/latex."
65
66 # Build plain text files
67 [group: 'build']
68 text:
69 {{ sphinxbuild }} -b text {{ allsphinxopts }} {{ builddir }}/text
70 @echo ""
71 @echo "Build finished. The text files are in {{ builddir }}/text."
72
73 # Build man pages
74 [group: 'build']
75 man:
76 {{ sphinxbuild }} -b man {{ allsphinxopts }} {{ builddir }}/man
77 @echo ""
78 @echo "Build finished. The manual pages are in {{ builddir }}/man."
79
80 # Build JSON output
81 [group: 'build']
82 json:
83 {{ sphinxbuild }} -b json {{ allsphinxopts }} {{ builddir }}/json
84 @echo ""
85 @echo "Build finished; now you can process the JSON files."
86
87 # Clean build directory
88 [group: 'misc']
89 [confirm]
90 clean:
91 rm -rf {{ builddir }}/*
92
93 # Build HTML help files
94 [group: 'misc']
95 htmlhelp:
96 {{ sphinxbuild }} -b htmlhelp {{ allsphinxopts }} {{ builddir }}/htmlhelp
97 @echo ""
98 @echo "Build finished; now you can run HTML Help Workshop with the .hhp project file in {{ builddir }}/htmlhelp."
99
100 # Build Qt help files
101 [group: 'misc']
102 qthelp:
103 {{ sphinxbuild }} -b qthelp {{ allsphinxopts }} {{ builddir }}/qthelp
104 @echo ""
105 @echo "Build finished; now you can run 'qcollectiongenerator' with the .qhcp project file in {{ builddir }}/qthelp."
106
107 # Build Devhelp files
108 [group: 'misc']
109 devhelp:
110 {{ sphinxbuild }} -b devhelp {{ allsphinxopts }} {{ builddir }}/devhelp
111 @echo ""
112 @echo "Build finished."
113
114 # Build Texinfo files
115 [group: 'misc']
116 texinfo:
117 {{ sphinxbuild }} -b texinfo {{ allsphinxopts }} {{ builddir }}/texinfo
118 @echo ""
119 @echo "Build finished. The Texinfo files are in {{ builddir }}/texinfo."
120
121 # Build Info files from Texinfo
122 [group: 'misc']
123 info:
124 {{ sphinxbuild }} -b texinfo {{ allsphinxopts }} {{ builddir }}/texinfo
125 @echo "Running Texinfo files through makeinfo..."
126 make -C {{ builddir }}/texinfo info
127 @echo "makeinfo finished; the Info files are in {{ builddir }}/texinfo."
128
129 # Build gettext catalogs
130 [group: 'misc']
131 gettext:
132 {{ sphinxbuild }} -b gettext {{ sphinxopts }} . {{ builddir }}/locale
133 @echo ""
134 @echo "Build finished. The message catalogs are in {{ builddir }}/locale."
135
136 # Check all external links
137 [group: 'validate']
138 linkcheck:
139 {{ sphinxbuild }} -b linkcheck {{ allsphinxopts }} {{ builddir }}/linkcheck
140 @echo ""
141 @echo "Link check complete; look for any errors in the above output or in {{ builddir }}/linkcheck/output.txt."
142
143 # Run doctests embedded in documentation
144 [group: 'validate']
145 doctest:
146 {{ sphinxbuild }} -b doctest {{ allsphinxopts }} {{ builddir }}/doctest
147 @echo "Testing of doctests in the sources finished, look at the results in {{ builddir }}/doctest/output.txt."
148
149 # Check build from scratch
150 [group: 'validate']
151 checkbuild:
152 rm -rf {{ builddir }}
153 {{ sphinxbuild }} -n -q ./ {{ builddir }}
154
155 # Build redirects configuration
156 [group: 'misc']
157 redirects:
158 {{ sphinxbuild }} -b rediraffewritediff {{ allsphinxopts }} {{ builddir }}/redirects
159 @echo ""
160 @echo "Build finished. The redirects are in rediraffe_redirects."
161
162 # Show changes overview
163 [group: 'misc']
164 changes:
165 {{ sphinxbuild }} -b changes {{ allsphinxopts }} {{ builddir }}/changes
166 @echo ""
167 @echo "The overview file is in {{ builddir }}/changes."
168
169 # Watch files and rebuild on change
170 [group: 'dev']
171 watch:
172 #!/usr/bin/env bash
173 set -euo pipefail
174 if command -v entr > /dev/null; then
175 ${{ watch_files }} | entr -c just html
176 else
177 just html
178 fi
179
180 # Serve documentation via Python http.server
181 [group: 'dev']
182 serve:
183 @echo '=============================================================='
184 @echo ''
185 @echo 'docs server running at http://localhost:{{ http_port }}/'
186 @echo ''
187 @echo '=============================================================='
188 python -m http.server {{ http_port }} --directory {{ builddir }}/html
189
190 # Watch and serve simultaneously
191 [group: 'dev']
192 dev:
193 #!/usr/bin/env bash
194 set -euo pipefail
195 just watch &
196 just serve
197
198 # Start sphinx-autobuild server
199 [group: 'dev']
200 start:
201 uv run sphinx-autobuild -b dirhtml "{{ sourcedir }}" "{{ builddir }}" {{ sphinxopts }} --port {{ http_port }}
202
203 # Design mode: watch static files and disable incremental builds
204 [group: 'dev']
205 design:
206 uv run sphinx-autobuild -b dirhtml "{{ sourcedir }}" "{{ builddir }}" {{ sphinxopts }} --port {{ http_port }} --watch "." -a