Skip to content
Snippets Groups Projects
Commit 692795f8 authored by Xu Cheng's avatar Xu Cheng
Browse files

list: support --full-name

Closes Homebrew/homebrew#29716.
parent 0276c3c7
No related branches found
No related tags found
No related merge requests found
require "metafiles"
require "formula"
module Homebrew
def list
......@@ -16,8 +17,21 @@ module Homebrew
if ARGV.include? '--pinned' or ARGV.include? '--versions'
filtered_list
elsif ARGV.named.empty?
ENV['CLICOLOR'] = nil
exec 'ls', *ARGV.options_only << HOMEBREW_CELLAR
if ARGV.include? "--full-name"
full_names = Formula.installed.map(&:full_name).sort do |a, b|
if a.include?("/") && !b.include?("/")
1
elsif !a.include?("/") && b.include?("/")
-1
else
a <=> b
end
end
puts_columns full_names
else
ENV['CLICOLOR'] = nil
exec 'ls', *ARGV.options_only << HOMEBREW_CELLAR
end
elsif ARGV.verbose? or not $stdout.tty?
exec "find", *ARGV.kegs.map(&:to_s) + %w[-not -type d -print]
else
......
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