mirror of https://github.com/borgbackup/borg.git
Merge pull request #297 from ThomasWaldmann/help-usage-docs
include the help offered by borg help <topic> in the usage docs, fixes #293
This commit is contained in:
commit
2c4196ed54
|
@ -371,6 +371,12 @@ Examples
|
|||
command="borg serve --restrict-to-path /mnt/backup" ssh-rsa AAAAB3[...]
|
||||
|
||||
|
||||
Miscellaneous Help
|
||||
------------------
|
||||
|
||||
.. include:: usage/help.rst.inc
|
||||
|
||||
|
||||
Additional Notes
|
||||
----------------
|
||||
|
||||
|
|
30
setup.py
30
setup.py
|
@ -150,19 +150,25 @@ class build_usage(Command):
|
|||
if not os.path.exists('docs/usage'):
|
||||
os.mkdir('docs/usage')
|
||||
for command, parser in choices.items():
|
||||
if command is 'help':
|
||||
continue
|
||||
print('generating help for %s' % command)
|
||||
with open('docs/usage/%s.rst.inc' % command, 'w') as doc:
|
||||
print('generating help for %s' % command)
|
||||
params = {"command": command,
|
||||
"underline": '-' * len('borg ' + command)}
|
||||
doc.write(".. _borg_{command}:\n\n".format(**params))
|
||||
doc.write("borg {command}\n{underline}\n::\n\n".format(**params))
|
||||
epilog = parser.epilog
|
||||
parser.epilog = None
|
||||
doc.write(re.sub("^", " ", parser.format_help(), flags=re.M))
|
||||
doc.write("\nDescription\n~~~~~~~~~~~\n")
|
||||
doc.write(epilog)
|
||||
if command == 'help':
|
||||
for topic in Archiver.helptext:
|
||||
params = {"topic": topic,
|
||||
"underline": '~' * len('borg help ' + topic)}
|
||||
doc.write(".. _borg_{topic}:\n\n".format(**params))
|
||||
doc.write("borg help {topic}\n{underline}\n::\n\n".format(**params))
|
||||
doc.write(Archiver.helptext[topic])
|
||||
else:
|
||||
params = {"command": command,
|
||||
"underline": '-' * len('borg ' + command)}
|
||||
doc.write(".. _borg_{command}:\n\n".format(**params))
|
||||
doc.write("borg {command}\n{underline}\n::\n\n".format(**params))
|
||||
epilog = parser.epilog
|
||||
parser.epilog = None
|
||||
doc.write(re.sub("^", " ", parser.format_help(), flags=re.M))
|
||||
doc.write("\nDescription\n~~~~~~~~~~~\n")
|
||||
doc.write(epilog)
|
||||
# return to regular Cython configuration, if we changed it
|
||||
if os.environ.get('BORG_CYTHON_DISABLE') == self.__class__.__name__:
|
||||
del os.environ['BORG_CYTHON_DISABLE']
|
||||
|
|
Loading…
Reference in New Issue