man: put option-style commands after regular ones

This commit is contained in:
Martin Afanasjew 2016-04-17 09:36:48 +02:00
parent d183ff8065
commit d29d58b3fb

View File

@ -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