diff options
author | jkeiser <jkeiser@opscode.com> | 2012-12-24 10:45:08 -0800 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:13 -0700 |
commit | e6c3b3f2d7bdbfad2b0421d65e782b165b7e06a2 (patch) | |
tree | ac1f80d317ed22d3e688ac582985c6ee98197bf5 | |
parent | cfc5d9e6f1a3804f1d5b674cec15b459916e3bee (diff) | |
download | chef-e6c3b3f2d7bdbfad2b0421d65e782b165b7e06a2.tar.gz |
Add --flat option to show full paths
-rw-r--r-- | lib/chef/knife/list.rb | 11 |
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 } |