ttrts/scripts/gen_manpage.sh
mdiluzio 2273c93f11 Update with more install targets.
Installing headers and library to /usr/local/
Requires workaround for version information header generation

Install a man page

Install some basic bash completion for maps

Also update the readme to fit with the manpage and new autocompletion features

Fixes the oddity where generated map files were missing the initial line of the header
2014-12-30 18:37:46 +00:00

29 lines
993 B
Bash
Executable file

#! /bin/bash
# Used to a man page from markdown
echo ".\" Man page for the ttrts project" > $1
echo ".\" this man page is auto-generated, do not edit directly" >> $1
echo ".TH TTRTS\ v0.3.0 6 $(date +%Y-%m-%d) http://mdiluz.github.io/ttrts/" >> $1
# sections to section headers
# sub-sections in man page sub-sections
# 4-space lines to tabs
# tab starts removed
# Environment variables in bold
# User variables in italics
# remove all line-widths
# Put all back-ticks quotes in bold
# underline mapfile opt
# ensure name section uses correct
cat "$2" \
| sed -r 's/^# (\w+)/.SH \1/g' \
| sed -r 's/^##+ (\w+)/.SS \1/g' \
| sed -r 's/^ (.*)$/\n\t\1\n/g' \
| sed -r 's/^\t//g' \
| sed -r 's/\$\{(\w+)\}/\\fB\$\1\\fR/g' \
| sed -r 's/\{(\w+)\}/\\fI\1\\fR/g' \
| sed -r 's/-----+//g' \
| sed -r 's/`(.*?)`/\\fB\1\\fR/g' \
| sed -r 's/MAPFILE/\\fImapfile\\fR/g' \
| sed -r 's/\tttrts -/\tttrts \\-/g' >> $1