@@ -79,6 +79,7 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
79
79
80
80
long := ls .Flags ().BoolP ("long" , "l" , false , "Print full path" )
81
81
all := ls .Flags ().BoolP ("all" , "a" , false , "Find all under the paths given" )
82
+ quick := ls .Flags ().BoolP ("quick" , "q" , false , "True to turn off headers, etc." )
82
83
83
84
ls .RunE = func (c * cobra.Command , args []string ) error {
84
85
paths := []string {"." }
@@ -92,7 +93,7 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
92
93
paths = args
93
94
}
94
95
95
- for _ , p := range paths {
96
+ for i , p := range paths {
96
97
97
98
if p == "/" {
98
99
// TODO(chungers) -- this is a 'local' infrakit ensemble.
@@ -116,7 +117,7 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
116
117
return err
117
118
}
118
119
119
- for _ , target := range targets {
120
+ for j , target := range targets {
120
121
121
122
nodes := []metadata.Path {} // the result set to print
122
123
@@ -139,6 +140,7 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
139
140
nodes = append (nodes , metadata_plugin .Path (t ))
140
141
}
141
142
}
143
+
142
144
} else {
143
145
if * all {
144
146
allPaths , err := listAll (match , path .Shift (1 ))
@@ -159,10 +161,28 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
159
161
}
160
162
}
161
163
164
+ if p == "." && ! * all {
165
+ // special case of showing the top level plugin namespaces
166
+ if i > 0 && ! * quick {
167
+ fmt .Println ()
168
+ }
169
+ for _ , l := range nodes {
170
+ if * long {
171
+ fmt .Println (metadata_plugin .String (l ))
172
+ } else {
173
+ fmt .Println (metadata_plugin .String (l .Rel (path )))
174
+ }
175
+ }
176
+ break
177
+ }
178
+
162
179
if len (targets ) > 1 {
180
+ if j > 0 && ! * quick {
181
+ fmt .Println ()
182
+ }
163
183
fmt .Printf ("%s:\n " , target )
164
184
}
165
- if * long {
185
+ if * long && ! * quick {
166
186
fmt .Printf ("total %d:\n " , len (nodes ))
167
187
}
168
188
for _ , l := range nodes {
@@ -172,7 +192,6 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
172
192
fmt .Println (metadata_plugin .String (l .Rel (path )))
173
193
}
174
194
}
175
- fmt .Println ()
176
195
}
177
196
178
197
}
0 commit comments