2016-09-13 21:40:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Generates `docstring.go` having `genDocString` variable with `go doc` output.
|
|
|
|
#
|
|
|
|
# This script is called in `doc.go` using `go generate` to embed the
|
|
|
|
# documentation inside the binary in order to show it on request with `-doc`
|
|
|
|
# command line flag. Thus the same documentation is used for online and
|
|
|
|
# terminal display.
|
|
|
|
|
2016-12-19 19:45:37 +00:00
|
|
|
tmp=gen/docstring.go
|
2016-09-15 14:08:05 +00:00
|
|
|
|
2018-07-05 20:09:53 +00:00
|
|
|
echo "// Code generated by gen/docstring.sh DO NOT EDIT." >> $tmp
|
2016-09-15 14:08:05 +00:00
|
|
|
echo >> $tmp
|
|
|
|
echo "package main" >> $tmp
|
|
|
|
echo >> $tmp
|
|
|
|
echo "var genDocString = \`" >> $tmp
|
|
|
|
go doc | tr "\`" "'" >> $tmp
|
|
|
|
echo "\`" >> $tmp
|
|
|
|
|
|
|
|
mv $tmp docstring.go
|