Skip to content

Commit

Permalink
Set link for man pages' source
Browse files Browse the repository at this point in the history
So, contributors can get fast to source of our man pages.

Signed-off-by: George Melikov <[email protected]>
  • Loading branch information
gmelikov committed Oct 24, 2021
1 parent 3c04e92 commit 0fb4f1c
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions scripts/man_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
LOG = logging.getLogger()
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

zfs_repo_url = 'https://github.com/openzfs/zfs/'

man_sections = {
'1': 'User Commands',
Expand Down Expand Up @@ -99,8 +100,9 @@ def run(in_dir, out_dir):
os.makedirs(man_path, exist_ok=True)
with open(os.path.join(man_path, 'index.rst'), "w") as f:
f.write(
"""
.. THIS FILE IS AUTOGENERATED, DO NOT EDIT!
""".. THIS FILE IS AUTOGENERATED, DO NOT EDIT!
:github_url: {zfs_repo_url}blob/master/man/
{name}
{name_sub}
Expand All @@ -109,7 +111,8 @@ def run(in_dir, out_dir):
:glob:
*/index
""".format(name=man_section_name,
""".format(zfs_repo_url=zfs_repo_url,
name=man_section_name,
name_sub="=" * len(man_section_name))
)

Expand All @@ -123,8 +126,9 @@ def run(in_dir, out_dir):
name=section_name, num=section_num)
with open(os.path.join(rst_dir, 'index.rst'), "w") as f:
f.write(
"""
.. THIS FILE IS AUTOGENERATED, DO NOT EDIT!
""".. THIS FILE IS AUTOGENERATED, DO NOT EDIT!
:github_url: {zfs_repo_url}blob/master/man/man{section_num}/
{name}
{name_sub}
Expand All @@ -133,14 +137,17 @@ def run(in_dir, out_dir):
:glob:
*
""".format(name=section_name_with_num,
name_sub="=" * len(section_name_with_num))
""".format(zfs_repo_url=zfs_repo_url,
section_num=section_num,
name=section_name_with_num,
name_sub="=" * len(section_name_with_num),)
)
for page in section_pages:
with open(os.path.join(rst_dir, page + '.rst'), "w") as f:
f.write(
"""
.. THIS FILE IS AUTOGENERATED, DO NOT EDIT!
""".. THIS FILE IS AUTOGENERATED, DO NOT EDIT!
:github_url: {zfs_repo_url}blob/master/man/man{section_num}/{name}
{name}
{name_sub}
Expand All @@ -154,7 +161,8 @@ def run(in_dir, out_dir):
.. raw:: html
</div>
""".format(name=page,
""".format(zfs_repo_url=zfs_repo_url,
name=page,
build_dir=build_dir,
section_num=section_num,
name_sub="=" * len(page))
Expand Down

0 comments on commit 0fb4f1c

Please sign in to comment.