aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/recipients.rb
blob: 16b5a883ba1e74da575f0ca6199454dbeb22f0e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module Keyringer
  class Recipients
    def execute
      subCommand = ARGV[2]
      parameters = ARGV[3..-1]

      recipients    = Keyring::Recipients.new
      
      if subCommand == "add"
        recipients.addRecipient(ARGV[3], ARGV[4])
      elsif subCommand == "remove"
        recipients.removeRecipient(ARGV[3])
      elsif subCommand == "list"
        recipients.listRecipients().each() do |recipient|
          puts("#{recipient.email}     #{recipient.keySignature}")
        end
      else
        throw "Invalid recipients command: #{subCommand} "
      end
      
      return ""
    end
  end
end