Module: Imap::Backup::CLI::Helpers

Included in:
Imap::Backup::CLI, Backup, Folders, Local, Remote, Restore, Status, Utils
Defined in:
lib/imap/backup/cli/helpers.rb

Instance Method Summary collapse

Instance Method Details

#account(email) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/imap/backup/cli/helpers.rb', line 12

def (email)
  accounts = Imap::Backup::CLI::Accounts.new
   = accounts.find { |a| a.username == email }
  raise "#{email} is not a configured account" if !

  
end

#connection(email) ⇒ Object



20
21
22
23
24
# File 'lib/imap/backup/cli/helpers.rb', line 20

def connection(email)
   = (email)

  Imap::Backup::::Connection.new()
end

#each_connection(names) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/imap/backup/cli/helpers.rb', line 26

def each_connection(names)
  accounts = Imap::Backup::CLI::Accounts.new(names)

  accounts.each do ||
    yield .connection
  end
rescue Imap::Backup::ConfigurationNotFound
  raise "imap-backup is not configured. Run `imap-backup setup`"
end

#symbolized(options) ⇒ Object



5
6
7
8
9
10
# File 'lib/imap/backup/cli/helpers.rb', line 5

def symbolized(options)
  options.each.with_object({}) do |(k, v), acc|
    key = k.gsub("-", "_").intern
    acc[key] = v
  end
end