From e6c3b3f2d7bdbfad2b0421d65e782b165b7e06a2 Mon Sep 17 00:00:00 2001 From: jkeiser Date: Mon, 24 Dec 2012 10:45:08 -0800 Subject: Add --flat option to show full paths --- lib/chef/knife/list.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/chef/knife/list.rb') 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 } -- cgit v1.2.1