Implements top level help command. This is what is called when ``aws help`` is run.
| 455 | |
| 456 | |
| 457 | class ProviderHelpCommand(HelpCommand): |
| 458 | """Implements top level help command. |
| 459 | |
| 460 | This is what is called when ``aws help`` is run. |
| 461 | |
| 462 | """ |
| 463 | |
| 464 | EventHandlerClass = ProviderDocumentEventHandler |
| 465 | |
| 466 | def __init__( |
| 467 | self, |
| 468 | session, |
| 469 | command_table, |
| 470 | arg_table, |
| 471 | description, |
| 472 | synopsis, |
| 473 | usage, |
| 474 | ): |
| 475 | HelpCommand.__init__(self, session, None, command_table, arg_table) |
| 476 | self.description = description |
| 477 | self.synopsis = synopsis |
| 478 | self.help_usage = usage |
| 479 | self._subcommand_table = None |
| 480 | self._topic_tag_db = None |
| 481 | self._related_items = ['aws help topics'] |
| 482 | |
| 483 | @property |
| 484 | def event_class(self): |
| 485 | return 'aws' |
| 486 | |
| 487 | @property |
| 488 | def name(self): |
| 489 | return 'aws' |
| 490 | |
| 491 | @property |
| 492 | def url(self): |
| 493 | return f"{self._base_remote_url}/index.html" |
| 494 | |
| 495 | @property |
| 496 | def subcommand_table(self): |
| 497 | if self._subcommand_table is None: |
| 498 | if self._topic_tag_db is None: |
| 499 | self._topic_tag_db = TopicTagDB() |
| 500 | self._topic_tag_db.load_json_index() |
| 501 | self._subcommand_table = self._create_subcommand_table() |
| 502 | return self._subcommand_table |
| 503 | |
| 504 | def _create_subcommand_table(self): |
| 505 | subcommand_table = {} |
| 506 | # Add the ``aws help topics`` command to the ``topic_table`` |
| 507 | topic_lister_command = TopicListerCommand(self.session) |
| 508 | subcommand_table['topics'] = topic_lister_command |
| 509 | topic_names = self._topic_tag_db.get_all_topic_names() |
| 510 | |
| 511 | # Add all of the possible topics to the ``topic_table`` |
| 512 | for topic_name in topic_names: |
| 513 | topic_help_command = TopicHelpCommand(self.session, topic_name) |
| 514 | subcommand_table[topic_name] = topic_help_command |
no outgoing calls