Skip to content
Snippets Groups Projects
Commit d29d58b3 authored by Martin Afanasjew's avatar Martin Afanasjew
Browse files

man: put option-style commands after regular ones

parent d183ff80
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ module Homebrew ...@@ -44,7 +44,7 @@ module Homebrew
variables = OpenStruct.new variables = OpenStruct.new
variables[:commands] = Pathname.glob("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}"). 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| map { |source_file|
source_file.read.lines. source_file.read.lines.
grep(/^#:/). grep(/^#:/).
...@@ -56,6 +56,11 @@ module Homebrew ...@@ -56,6 +56,11 @@ module Homebrew
ERB.new(template, nil, ">").result(variables.instance_eval{ binding }) ERB.new(template, nil, ">").result(variables.instance_eval{ binding })
end 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) def convert_man_page(markup, target)
shared_args = %W[ shared_args = %W[
--pipe --pipe
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment