2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2013-09-14 16:58:26 -07:00
|
|
|
def commands
|
2015-07-09 19:50:53 +08:00
|
|
|
if ARGV.include? "--quiet"
|
|
|
|
cmds = internal_commands + external_commands
|
|
|
|
cmds += HOMEBREW_INTERNAL_COMMAND_ALIASES.keys if ARGV.include? "--include-aliases"
|
|
|
|
puts_columns cmds.sort
|
|
|
|
else
|
|
|
|
# Find commands in Homebrew/cmd
|
|
|
|
puts "Built-in commands"
|
|
|
|
puts_columns internal_commands
|
2013-09-14 16:58:26 -07:00
|
|
|
|
2015-07-09 19:50:53 +08:00
|
|
|
# Find commands in the path
|
|
|
|
unless (exts = external_commands).empty?
|
|
|
|
puts
|
|
|
|
puts "External commands"
|
|
|
|
puts_columns exts
|
|
|
|
end
|
2013-09-14 16:58:26 -07:00
|
|
|
end
|
|
|
|
end
|
2015-07-09 19:50:53 +08:00
|
|
|
|
|
|
|
def internal_commands
|
|
|
|
with_directory = false
|
2015-09-10 21:20:34 +08:00
|
|
|
cmds = (HOMEBREW_LIBRARY_PATH/"cmd").children(with_directory).map { |f| File.basename(f, ".rb") }
|
|
|
|
if ARGV.homebrew_developer?
|
|
|
|
cmds += (HOMEBREW_LIBRARY_PATH/"dev-cmd").children(with_directory).map { |f| File.basename(f, ".rb") }
|
|
|
|
end
|
|
|
|
cmds
|
2015-07-09 19:50:53 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def external_commands
|
2015-08-06 17:12:35 +08:00
|
|
|
paths.flat_map { |p| Dir["#{p}/brew-*"] }.
|
2015-08-03 13:09:07 +01:00
|
|
|
map { |f| File.basename(f, ".rb")[5..-1] }.
|
|
|
|
reject { |f| f =~ /\./ }
|
2015-07-09 19:50:53 +08:00
|
|
|
end
|
2013-09-14 16:58:26 -07:00
|
|
|
end
|