Sha256: 62ca550727f8c314323b0f72e4e46ad5ad5e5c41609c7fbfe64f98ae5f31150f

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

module Imap; end

module Imap::Backup
  class CLI::Restore < Thor
    include Thor::Actions
    include CLI::Helpers

    attr_reader :email
    attr_reader :options

    def initialize(email = nil, options)
      super([])
      @email = email
      @options = options
    end

    no_commands do
      def run
        config = load_config(**options)
        case
        when email && !options.key?(:accounts)
          account = account(config, email)
          account.restore
        when !email && !options.key?(:accounts)
          Logger.logger.info "Calling restore without an EMAIL parameter is deprecated"
          config.accounts.map(&:restore)
        when email && options.key?(:accounts)
          raise "Missing EMAIL parameter"
        when !email && options.key?(:accounts)
          Logger.logger.info(
            "Calling restore with the --account option is deprected, " \
            "please pass a single EMAIL parameter"
          )
          requested_accounts(config).each(&:restore)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
imap-backup-13.1.0 lib/imap/backup/cli/restore.rb
imap-backup-13.0.0 lib/imap/backup/cli/restore.rb
imap-backup-12.1.0 lib/imap/backup/cli/restore.rb
imap-backup-12.0.0 lib/imap/backup/cli/restore.rb
imap-backup-11.1.0 lib/imap/backup/cli/restore.rb
imap-backup-11.1.0.rc1 lib/imap/backup/cli/restore.rb
imap-backup-11.0.1 lib/imap/backup/cli/restore.rb
imap-backup-11.0.0 lib/imap/backup/cli/restore.rb
imap-backup-11.0.0.rc1 lib/imap/backup/cli/restore.rb
imap-backup-10.0.1 lib/imap/backup/cli/restore.rb