@@ -79,6 +79,7 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
7979
8080 long := ls .Flags ().BoolP ("long" , "l" , false , "Print full path" )
8181 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." )
8283
8384 ls .RunE = func (c * cobra.Command , args []string ) error {
8485 paths := []string {"." }
@@ -92,7 +93,7 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
9293 paths = args
9394 }
9495
95- for _ , p := range paths {
96+ for i , p := range paths {
9697
9798 if p == "/" {
9899 // TODO(chungers) -- this is a 'local' infrakit ensemble.
@@ -116,7 +117,7 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
116117 return err
117118 }
118119
119- for _ , target := range targets {
120+ for j , target := range targets {
120121
121122 nodes := []metadata.Path {} // the result set to print
122123
@@ -139,6 +140,7 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
139140 nodes = append (nodes , metadata_plugin .Path (t ))
140141 }
141142 }
143+
142144 } else {
143145 if * all {
144146 allPaths , err := listAll (match , path .Shift (1 ))
@@ -159,10 +161,28 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
159161 }
160162 }
161163
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+
162179 if len (targets ) > 1 {
180+ if j > 0 && ! * quick {
181+ fmt .Println ()
182+ }
163183 fmt .Printf ("%s:\n " , target )
164184 }
165- if * long {
185+ if * long && ! * quick {
166186 fmt .Printf ("total %d:\n " , len (nodes ))
167187 }
168188 for _ , l := range nodes {
@@ -172,7 +192,6 @@ func metadataCommand(plugins func() discovery.Plugins) *cobra.Command {
172192 fmt .Println (metadata_plugin .String (l .Rel (path )))
173193 }
174194 }
175- fmt .Println ()
176195 }
177196
178197 }
0 commit comments