aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMartin Afanasjew2016-04-17 09:36:48 +0200
committerMartin Afanasjew2016-04-20 13:45:26 +0200
commitd29d58b3fb1d34d990e2cba5e3f60ab0617b4582 (patch)
tree2022d9c3a08629ac8ffe3ba63be657a8387c4283 /Library
parentd183ff8065aafd3def71f9c9c728a3a92c1c4742 (diff)
downloadbrew-d29d58b3fb1d34d990e2cba5e3f60ab0617b4582.tar.bz2
man: put option-style commands after regular ones
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/man.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/cmd/man.rb
index eb6679743..bc382d29f 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