summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkeiser <jkeiser@opscode.com>2012-12-24 10:45:08 -0800
committerJohn Keiser <jkeiser@opscode.com>2013-06-07 13:12:13 -0700
commite6c3b3f2d7bdbfad2b0421d65e782b165b7e06a2 (patch)
treeac1f80d317ed22d3e688ac582985c6ee98197bf5
parentcfc5d9e6f1a3804f1d5b674cec15b459916e3bee (diff)
downloadchef-e6c3b3f2d7bdbfad2b0421d65e782b165b7e06a2.tar.gz
Add --flat option to show full paths
-rw-r--r--lib/chef/knife/list.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/chef/knife/list.rb b/lib/chef/knife/list.rb
index 4b6767f4ee..6702620b5e 100644
--- a/lib/chef/knife/list.rb
+++ b/lib/chef/knife/list.rb
@@ -20,6 +20,10 @@ class Chef
:long => '--local',
:boolean => true,
:description => "List local directory instead of remote"
+ option :flat,
+ :long => '--flat',
+ :boolean => true,
+ :description => "Show a list of filenames rather than the prettified ls-like output normally produced"
def run
patterns = name_args.length == 0 ? [""] : name_args
@@ -39,6 +43,13 @@ class Chef
end
end
+ if config[:flat]
+ dir_results.each do |result, children|
+ results += children
+ end
+ dir_results = []
+ end
+
results = results.sort_by { |result| result.path }
dir_results = dir_results.sort_by { |result| result[0].path }