lib/cli/credential_task.rb in factor-0.1.07 vs lib/cli/credential_task.rb in factor-0.1.09

- old
+ new

@@ -2,27 +2,30 @@ require 'cli/command' module Factor module CLI class CredentialTask < Command + - desc "list [KEY]", "list all the credentials" - #method_option :key, :alias=>"-k", :type=>:string, :desc=>"key reference" - def list(key="") - puts @client.get_credential(key)["value"] + desc "set SERVICE NAME VALUE", "add a key and value for the credential" + method_option :key, :type=>:string, :desc=>"File reference containing the symmetric key for encryption" + def set(service,name,value) + securet=nil + if options[:key] + secret=File.read(options[:key]) + end + puts @client.set_credential(service,name,value,secret) end - - desc "set KEY VALUE", "add a key and value for the credential" - #method_option :key, :alias=>"-k", :type=>:string, :desc=>"key reference" - #method_option :value, :alias=>"-v", :type=>:string, :desc=>"values" - def set(key,value) - puts @client.set_credential(key,value) + + desc "list", "get all of the credential" + def list() + puts @client.get_credentials() end - # desc "remove KEY", "remove a value from the credentials bag" - # def remove(key) - # puts @client.remove_credential(key) - # end + desc "remove SERVICE NAME", "remove a value from the credentials bag" + def remove(service,name) + puts @client.remove_credential(service,name) + end end end end \ No newline at end of file