10618f323f2915c2a7281e258a42d05faf1cc1af

Author
Matt Outten <moutten@squaremouth.com>
Committer
Matt Outten <moutten@squaremouth.com>
Date

Message

Add the --format tag to knife list commands

This commit adds the --format tag to all of the autocompletion functions. The default format changed from json to a "human readable" format as of version 0.10.  This change should be backward compatible.  Alternatively, these commands could be simplified by using the new default human readable format.

Diff

 1diff --git a/plugins/knife/_knife b/plugins/knife/_knife
 2index 7f8c95ee5a470810785cb719828371a5e7463e6c..f336380a1069fd7d0fad331a8bb90aff5f34d9d6 100644
 3--- a/plugins/knife/_knife
 4+++ b/plugins/knife/_knife
 5@@ -138,27 +138,27 @@ _knife_options3() {
 6 
 7 # The chef_x_remote functions use knife to get a list of objects of type x on the server
 8 _chef_roles_remote() {
 9- (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
10+ (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
11 }
12 
13 _chef_clients_remote() {
14- (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
15+ (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
16 }
17 
18 _chef_nodes_remote() {
19- (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
20+ (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
21 }
22 
23 _chef_cookbooks_remote() {
24- (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
25+ (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
26 }
27 
28 _chef_sitecookbooks_remote() {
29- (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
30+ (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
31 }
32 
33 _chef_data_bags_remote() {
34- (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
35+ (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
36 }
37 
38 # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server