mirror of https://github.com/borgbackup/borg.git
Generate man page for borgfs (fixes #3216)
This commit is contained in:
parent
6f2bc44588
commit
17d5c794d3
|
@ -0,0 +1 @@
|
|||
.. include:: borgfs.rst.inc
|
20
setup.py
20
setup.py
|
@ -242,10 +242,11 @@ class build_usage(Command):
|
|||
# allows us to build docs without the C modules fully loaded during help generation
|
||||
from borg.archiver import Archiver
|
||||
parser = Archiver(prog='borg').build_parser()
|
||||
borgfs_parser = Archiver(prog='borgfs').build_parser()
|
||||
|
||||
self.generate_level("", parser, Archiver)
|
||||
self.generate_level("", parser, Archiver, {'borgfs': borgfs_parser})
|
||||
|
||||
def generate_level(self, prefix, parser, Archiver):
|
||||
def generate_level(self, prefix, parser, Archiver, extra_choices=None):
|
||||
is_subcommand = False
|
||||
choices = {}
|
||||
for action in parser._actions:
|
||||
|
@ -253,6 +254,8 @@ class build_usage(Command):
|
|||
is_subcommand = True
|
||||
for cmd, parser in action.choices.items():
|
||||
choices[prefix + cmd] = parser
|
||||
if extra_choices is not None:
|
||||
choices.update(extra_choices)
|
||||
if prefix and not choices:
|
||||
return
|
||||
print('found commands: %s' % list(choices.keys()))
|
||||
|
@ -505,12 +508,13 @@ class build_man(Command):
|
|||
# allows us to build docs without the C modules fully loaded during help generation
|
||||
from borg.archiver import Archiver
|
||||
parser = Archiver(prog='borg').build_parser()
|
||||
borgfs_parser = Archiver(prog='borgfs').build_parser()
|
||||
|
||||
self.generate_level('', parser, Archiver)
|
||||
self.generate_level('', parser, Archiver, {'borgfs': borgfs_parser})
|
||||
self.build_topic_pages(Archiver)
|
||||
self.build_intro_page()
|
||||
|
||||
def generate_level(self, prefix, parser, Archiver):
|
||||
def generate_level(self, prefix, parser, Archiver, extra_choices=None):
|
||||
is_subcommand = False
|
||||
choices = {}
|
||||
for action in parser._actions:
|
||||
|
@ -518,6 +522,8 @@ class build_man(Command):
|
|||
is_subcommand = True
|
||||
for cmd, parser in action.choices.items():
|
||||
choices[prefix + cmd] = parser
|
||||
if extra_choices is not None:
|
||||
choices.update(extra_choices)
|
||||
if prefix and not choices:
|
||||
return
|
||||
|
||||
|
@ -525,6 +531,9 @@ class build_man(Command):
|
|||
if command.startswith('debug') or command == 'help':
|
||||
continue
|
||||
|
||||
if command == "borgfs":
|
||||
man_title = command
|
||||
else:
|
||||
man_title = 'borg-' + command.replace(' ', '-')
|
||||
print('building man page', man_title + '(1)', file=sys.stderr)
|
||||
|
||||
|
@ -539,6 +548,9 @@ class build_man(Command):
|
|||
for subcommand in subparsers.choices:
|
||||
write('| borg', '[common options]', command, subcommand, '...')
|
||||
self.see_also.setdefault(command, []).append('%s-%s' % (command, subcommand))
|
||||
else:
|
||||
if command == "borgfs":
|
||||
write(command, end='')
|
||||
else:
|
||||
write('borg', '[common options]', command, end='')
|
||||
self.write_usage(write, parser)
|
||||
|
|
Loading…
Reference in New Issue