aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXu Cheng2015-06-20 22:48:45 +0800
committerXu Cheng2015-06-22 22:17:10 +0800
commit692795f82d24a810a2190bf3fb2ff71652df2a0a (patch)
treec8c61f36d3ea390a50268c067bad54de2b59ed50
parent0276c3c70ce8d0e3d4550c8c496bae3b3539349d (diff)
downloadbrew-692795f82d24a810a2190bf3fb2ff71652df2a0a.tar.bz2
list: support --full-name
Closes Homebrew/homebrew#29716.
-rw-r--r--Library/Homebrew/cmd/list.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb
index 405348e03..81a5caf4d 100644
--- a/Library/Homebrew/cmd/list.rb
+++ b/Library/Homebrew/cmd/list.rb
@@ -1,4 +1,5 @@
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