Skip to content

Commit

Permalink
Remove global options from topic tags
Browse files Browse the repository at this point in the history
Appending a global options section to topic tags
help pages caused sphinx hierarchy rule violations
in the config-vars help command. This commit fixes the
bug by removing global options from topic tags.
The removal doesn't cause any meaningful loss of
information since topic tags don't make use of
the global options.
  • Loading branch information
hssyoo committed Oct 14, 2022
1 parent 1df6ee1 commit 974caab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-docs-61070.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "docs",
"description": "Fixes `#7338 <https://github.com/aws/aws-cli/issues/7338>`__. Remove global options from topic tags."
}
3 changes: 3 additions & 0 deletions awscli/clidocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ def doc_options_start(self, help_command, **kwargs):
def doc_options_end(self, help_command, **kwargs):
pass

def doc_global_option(self, help_command, **kwargs):
pass

def doc_subitems_start(self, help_command, **kwargs):
doc = help_command.doc
doc.style.h2('Available Topics')
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_clidocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,11 @@ def test_description_tags_in_body(self):
contents = self.cmd.doc.getvalue().decode('utf-8')
self.assertIn(ref_body, contents)

def test_excludes_global_options(self):
self.doc_handler.doc_global_option(self.cmd)
global_options = self.cmd.doc.getvalue().decode('utf-8')
self.assertNotIn('Global Options', global_options)


class TestGlobalOptionsDocumenter(unittest.TestCase):
def create_help_command(self):
Expand Down

0 comments on commit 974caab

Please sign in to comment.