diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/cmd/man.rb index eb6679743a48e8c505b307aaf35ff3b68b8d166d..bc382d29f7b685e02df6d92137293ea827dca529 100644 --- a/Library/Homebrew/cmd/man.rb +++ b/Library/Homebrew/cmd/man.rb @@ -44,7 +44,7 @@ module Homebrew variables = OpenStruct.new variables[:commands] = Pathname.glob("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}"). - sort_by { |source_file| source_file.basename.sub(/\.(rb|sh)$/, "") }. + sort_by { |source_file| sort_key_for_path(source_file) }. map { |source_file| source_file.read.lines. grep(/^#:/). @@ -56,6 +56,11 @@ module Homebrew ERB.new(template, nil, ">").result(variables.instance_eval{ binding }) end + def sort_key_for_path(path) + # Options after regular commands (`~` comes after `z` in ASCII table). + path.basename.to_s.sub(/\.(rb|sh)$/, "").sub(/^--/, "~~") + end + def convert_man_page(markup, target) shared_args = %W[ --pipe