-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Fix #862 - Sorts Help Commands by Script #917
Conversation
This changes @commands from [] → {} which keeps track of each script as they are loaded. Then `helpCommands` returns an array after calling sort() on the commands of each script, rather than all scripts at once. Note that this means that the command `hubot help <TERM>` will show commands sorted by script still, since the filtering is done in the help script. A simple solution would be to have the help scripts call sort() after filtering, but this, of course, wouldn't be applied to existing installations.
How would this effect existing scripts that access Maybe could save this to a different object instead? |
True, since If two objects is ok, then that's easy to. What would be a good name? |
Also, should I do anything about the Travis error on 0.8.x? It looks like other builds have been failing recently, but I wasn't positive if it was the same... |
We've seen transient failures for 0.8 in the past. @technicalpickles can you fire it off again to see it the error clears? For backwards compatibility, I don't think we should support usage of internal variables in Robot. We should definitely lean on the side of maintaining backwards compatibility, but this feels like we are stretching a bit too far. Given that the "proper" method of retrieving the command list is via the method, any breakage should be easy to resolve by using the standard interface. On another note, I would love to see tests added here for |
They've been failing pretty consistently, so it's probably time to dig in and/or contact Travis about it.
I can appreciate the sentiment, it's just hard to take a hard stance though, when there's so much stuff out in the wild, and there's not necessarily an API for doing things without touching internal variables. I did a review of our own hubot, and we have one script that dynamically manipulates the I think that points to needing a function for adding for adding to the list of known commands, which hubot could use internally, as scripts using it externally. |
@technicalpickles @michaelansel I know it's been crazy lately, so thanks for everything you've all be been doing to make Hubot an awesome tool (and friend 😉 )! 👏 👏 |
The test is still failing which is weird. I'm still really hesitant to merge this because of API concerns I've mentioned. I know I'll have to make changes to our hubot for this upgrade, which says it's a breaking change to me. I would feel better if I could imagine a parrell object to it though. |
@cycomachead we had a pretty big PR drop (#803), so this isn't merging cleanly any more. I'd also like to point out something in the similar realm, #1025 . That'd expose more of the script documentation, and the hubot-advanced-help might provide a similar user experience you were suggesting. |
Closing since this is quite stale and there are merge conflicts. Thanks for taking time to contribute and sorry we weren't able to get this merged. |
This changes @commands from [] → {} which keeps track of each script
as they are loaded. Then
helpCommands
returns an array after callingsort() on the commands of each script, rather than all scripts at once.
Note that this means that the command
hubot help <TERM>
will showcommands sorted by script still, since the filtering is done in the help
script. A simple solution would be to have the help scripts call sort()
after filtering, but this, of course, wouldn't be applied to existing
installations.