mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-10 06:03:38 +00:00
man pages: generate page for subparsers, eg. borg-key(1)
Conflicts: docs/man/borg-key.1
This commit is contained in:
parent
fa24e1f38f
commit
1d9378f12c
2 changed files with 20 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
||||||
.\" Man page generated from reStructuredText.
|
.\" Man page generated from reStructuredText.
|
||||||
.
|
.
|
||||||
.TH BORG-KEY 1 "2017-02-11" "" "borg backup tool"
|
.TH BORG-KEY 1 "2017-02-12" "" "borg backup tool"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
borg-key \- Manage a keyfile or repokey of a repository
|
borg-key \- Manage a keyfile or repokey of a repository
|
||||||
.
|
.
|
||||||
|
|
14
setup.py
14
setup.py
|
@ -393,21 +393,29 @@ class build_man(Command):
|
||||||
man_title = 'borg-' + command.replace(' ', '-')
|
man_title = 'borg-' + command.replace(' ', '-')
|
||||||
print('building man page', man_title + '(1)', file=sys.stderr)
|
print('building man page', man_title + '(1)', file=sys.stderr)
|
||||||
|
|
||||||
if self.generate_level(command + ' ', parser, Archiver):
|
is_intermediary = self.generate_level(command + ' ', parser, Archiver)
|
||||||
continue
|
|
||||||
|
|
||||||
doc, write = self.new_doc()
|
doc, write = self.new_doc()
|
||||||
self.write_man_header(write, man_title, parser.description)
|
self.write_man_header(write, man_title, parser.description)
|
||||||
|
|
||||||
self.write_heading(write, 'SYNOPSIS')
|
self.write_heading(write, 'SYNOPSIS')
|
||||||
|
if is_intermediary:
|
||||||
|
subparsers = [action for action in parser._actions if 'SubParsersAction' in str(action.__class__)][0]
|
||||||
|
for subcommand in subparsers.choices:
|
||||||
|
write('| borg', command, subcommand, '...')
|
||||||
|
self.see_also.setdefault(command, []).append('%s-%s' % (command, subcommand))
|
||||||
|
else:
|
||||||
write('borg', command, end='')
|
write('borg', command, end='')
|
||||||
self.write_usage(write, parser)
|
self.write_usage(write, parser)
|
||||||
write('\n')
|
write('\n')
|
||||||
|
|
||||||
self.write_heading(write, 'DESCRIPTION')
|
|
||||||
description, _, notes = parser.epilog.partition('\n.. man NOTES')
|
description, _, notes = parser.epilog.partition('\n.. man NOTES')
|
||||||
|
|
||||||
|
if description:
|
||||||
|
self.write_heading(write, 'DESCRIPTION')
|
||||||
write(description)
|
write(description)
|
||||||
|
|
||||||
|
if not is_intermediary:
|
||||||
self.write_heading(write, 'OPTIONS')
|
self.write_heading(write, 'OPTIONS')
|
||||||
write('See `borg-common(1)` for common options of Borg commands.')
|
write('See `borg-common(1)` for common options of Borg commands.')
|
||||||
write()
|
write()
|
||||||
|
|
Loading…
Add table
Reference in a new issue