Skip to content

Commit

Permalink
Resort help output by utility
Browse files Browse the repository at this point in the history
  • Loading branch information
ConradIrwin committed Mar 2, 2012
1 parent 563f6e8 commit e3f6817
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/pry/default_commands/help.rb
Expand Up @@ -42,7 +42,7 @@ def process
def display_index(groups)
help_text = []

groups.keys.sort.each do |key|
groups.keys.sort_by(&method(:group_sort_key)).each do |key|
commands = groups[key].sort_by{ |command| command.options[:listing].to_s }

unless commands.empty?
Expand Down Expand Up @@ -117,6 +117,10 @@ def search_hash(search, hash)
def normalize(key)
key.downcase.gsub(/pry\W+/, '')
end

def group_sort_key(group_name)
[%w(Help Context Editing Introspection Input_and_output Navigating_pry Gems Basic Commands).index(group_name.gsub(' ', '_')) || 99, group_name]
end
end
end
end
Expand Down

0 comments on commit e3f6817

Please sign in to comment.