-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Topic command #1147
Topic command #1147
Conversation
def test_regular_call(self): | ||
with mock.patch('awscli.help.TopicListerCommand.__call__') \ | ||
as topics_call: | ||
with mock.patch('awscli.help.TopicHelpCommand.__call__') \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not like the style in which I am trying to test this (way too many mocks). I am trying to test that if nothing is added after aws help
, only the general HelpCommand
is called. The hard part is that TopicListerCommand
and TopicHelpCommand
both inherit it from HelpCommand
. Any ideas on a cleaner way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decorators should make this a bit less painful. For example:
@mock.patch('awscli.help.TopicListerCommand.__call__')
@mock.patch('awscli.help.TopicHelpCommand.__call__')
@mock.patch('awscli.help.HelpCommand.__call__')
def test_regular_call(self, help_command, topic_help_command, topic_lister_command):
self.cmd([], None)
help_command.assert_called()
self.assertFalse(topic_lister_command.called)
self.assertFalse(topic_help_command.called)
Still not perfect, but it's a little cleaner IMO. Also, maybe you don't need the .__call__
part of it?
Overall LGTM, but I'm not that familiar with the CLI's help system. |
d87d78d
to
a273f7c
Compare
1 similar comment
With the recent commits on this pull request, I did the following:
|
self._topic_table = None | ||
self._topic_tag_db = None | ||
self._related_items = [ | ||
'AWS CLI Topic Guide (`aws help topics <../topic/index.html>`_)'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're mixing layers here. Prior to this, the help commands knew nothing about how the documentation was actually going to be formatted, nor did they contain any RST markup. This seems like a concern of bcdoc and the clidoc event handlers.
Feature wise, I think this is pretty cool. I'm working on some topic guides now, and so far it seems to be working great. The one thing that I find a little confusing is the usage of multiple categories. I think it will be hard to tell with so few topic guides initially, but I was thinking of categories as the more broad and general concept to associate with the topic. So for example, "return-codes" would not be be part of the "S3 category", I'd only add it to the "General" category. However, if we add something like "tags", then I could see return-codes being tagged with "S3", because there are some S3 specifics to the return code topic guide. However, as it currently stands, it's a little confusing to see return-codes listed under S3, but upon reading the topic, seeing that the topic is about return codes in general. Code wise, I would prefer that we be more consistent with how the layering currently works with the existing doc components. From what I can tell, prior to this we have:
With this change, the layers seems to be more fuzzy. For example:
Overall though, I think we're heading in the right direction. |
Talked to @jamesls about this. Here is the summary of each point in the conversation:
I will send a PR for the the first and third point first, and then update the PR with the fix for the second and fourth point. |
Note these test will fail until this PR is merged: boto/bcdoc#34 |
@jamesls The PR is now rebased off of the HEAD of develop. Should be good to get looked at. |
Looks good. |
This is the second to last PR needed to have the topic help extension fully implemented. This pull request implements the
aws help topics
andaws help <topic-name>
commands. Here is a sample of whataws help topics
looks like from the command line currently:Here is what
aws help return-codes
looks like from the command line currently:This is the second to last pull request because it does not have the following:
aws help topics
when you runaws help
or a usage error is thrownThose will be part of a PR that will fully promote the use of the topic commands, as this PR just exposes but does not document/promote the topic guide quite just yet. Let me know if you would like to see any of the items I listed included in this PR.
cc @jamesls @danielgtaylor