mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-12 15:20:20 +00:00
Merge pull request #228 from anarcat/faster-usage
generate usage include files only as needed
This commit is contained in:
commit
3b1fae6b34
3 changed files with 21 additions and 15 deletions
|
@ -36,8 +36,7 @@ help:
|
||||||
clean:
|
clean:
|
||||||
-rm -rf $(BUILDDIR)/*
|
-rm -rf $(BUILDDIR)/*
|
||||||
|
|
||||||
html:
|
html: usage
|
||||||
./update_usage.sh
|
|
||||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||||
@echo
|
@echo
|
||||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||||
|
@ -140,3 +139,17 @@ gh-io: html
|
||||||
|
|
||||||
inotify: html
|
inotify: html
|
||||||
while inotifywait -r . --exclude usage.rst --exclude '_build/*' ; do make html ; done
|
while inotifywait -r . --exclude usage.rst --exclude '_build/*' ; do make html ; done
|
||||||
|
|
||||||
|
# generate list of targets
|
||||||
|
usage: $(shell borg help | grep -A1 "Available commands:" | tail -1 | sed 's/[{} ]//g;s/,\|^/.rst.inc usage\//g;s/^.rst.inc//;s/usage\/help//')
|
||||||
|
|
||||||
|
# generate help file based on usage
|
||||||
|
usage/%.rst.inc: ../borg/archiver.py
|
||||||
|
@echo generating usage for $*
|
||||||
|
@printf ".. _borg_$*:\n\n" > $@
|
||||||
|
@printf "borg $*\n" >> $@
|
||||||
|
@echo -n borg $* | tr 'a-z- ' '-' >> $@
|
||||||
|
@printf "\n::\n\n" >> $@
|
||||||
|
@borg help $* --usage-only | sed -e 's/^/ /' >> $@
|
||||||
|
@printf "\nDescription\n~~~~~~~~~~~\n" >> $@
|
||||||
|
@borg help $* --epilog-only >> $@
|
||||||
|
|
6
docs/api.rst
Normal file
6
docs/api.rst
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Borg Backup API documentation
|
||||||
|
=============================
|
||||||
|
|
||||||
|
.. automodule:: borg
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
if [ ! -d usage ]; then
|
|
||||||
mkdir usage
|
|
||||||
fi
|
|
||||||
for cmd in change-passphrase check create delete extract info init list mount prune serve; do
|
|
||||||
FILENAME="usage/$cmd.rst.inc"
|
|
||||||
LINE=`echo -n borg $cmd | tr 'a-z- ' '-'`
|
|
||||||
echo -e ".. _borg_$cmd:\n" > $FILENAME
|
|
||||||
echo -e "borg $cmd\n$LINE\n::\n\n" >> $FILENAME
|
|
||||||
borg help $cmd --usage-only | sed -e 's/^/ /' >> $FILENAME
|
|
||||||
echo -e "\nDescription\n~~~~~~~~~~~\n" >> $FILENAME
|
|
||||||
borg help $cmd --epilog-only >> $FILENAME
|
|
||||||
done
|
|
Loading…
Add table
Reference in a new issue