Class: Imap::Backup::CLI::Remote

Inherits:
Thor
  • Object
show all
Includes:
Helpers, Thor::Actions
Defined in:
lib/imap/backup/cli/remote.rb

Overview

Implements the CLI functions relating to configured online accounts

Instance Method Summary collapse

Methods included from Helpers

#account, included, #load_config, #options, #requested_accounts

Instance Method Details

#capabilities(email) ⇒ void

This method returns an undefined value.

Prints an account’s IMAP capabilities



44
45
46
47
48
49
50
# File 'lib/imap/backup/cli/remote.rb', line 44

def capabilities(email)
  Imap::Backup::Logger.setup_logging options
  config = load_config(**options)
   = (config, email)
  capabilities = .capabilities
  Kernel.puts capabilities.join(", ")
end

#folders(email) ⇒ void

This method returns an undefined value.

Prints an account’s folders



23
24
25
26
27
28
29
30
31
32
# File 'lib/imap/backup/cli/remote.rb', line 23

def folders(email)
  Imap::Backup::Logger.setup_logging options
  folder_names = folder_names(email)
  case options[:format]
  when "json"
    json_format_names folder_names
  else
    list_names folder_names
  end
end

#namespaces(email) ⇒ void

This method returns an undefined value.

Prints an account’s IMAP namespaces



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/imap/backup/cli/remote.rb', line 65

def namespaces(email)
  Imap::Backup::Logger.setup_logging options
  config = load_config(**options)
   = (config, email)
  namespaces = .namespaces
  case options[:format]
  when "json"
    json_format_namespaces namespaces
  else
    list_namespaces namespaces
  end
end