Commit 1bb18d0

mokha <mokha@cisco.com>
2018-02-05 22:12:46
add metadata list command.
1 parent ed59c68
Changed files (2)
lib/saml/kit/cli/metadata.rb
@@ -7,6 +7,13 @@ module Saml
           say registry.register_url(url).to_xml(pretty: true), :green
         end
 
+        desc "list", "List each of the registered entityId's"
+        def list
+          registry.each do |x|
+            say x.entity_id, :green
+          end
+        end
+
         private
 
         def registry
lib/saml/kit/cli/yaml_registry.rb
@@ -16,6 +16,14 @@ module Saml
         def metadata_for(entity_id)
           Saml::Kit::Metadata.from(@items[entity_id])
         end
+
+        def each
+          @items.transaction do
+            @items.roots.each do |key|
+              yield metadata_for(key)
+            end
+          end
+        end
       end
     end
   end