Class: Imap::Backup::CLI
- Inherits:
-
Thor
- Object
- Thor
- Imap::Backup::CLI
show all
- Includes:
- Helpers
- Defined in:
- lib/imap/backup/cli.rb,
lib/imap/backup/cli/local/check.rb
Defined Under Namespace
Modules: Helpers
Classes: Backup, FolderEnumerator, Local, Migrate, Mirror, Remote, Restore, Setup, Stats, Utils
Constant Summary
collapse
- VERSION_ARGUMENTS =
%w(-v --version).freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Helpers
#account, included, #load_config, #options, #requested_accounts
Class Method Details
.exit_on_failure? ⇒ Boolean
48
49
50
|
# File 'lib/imap/backup/cli.rb', line 48
def self.exit_on_failure?
true
end
|
.start(*args) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/imap/backup/cli.rb', line 27
def self.start(*args)
version_argument = ARGV & VERSION_ARGUMENTS
if version_argument.any?
new.version
exit 0
end
first_argument_is_help = ARGV[0] == "help"
second_argument_is_subcommand = subcommands.include?(ARGV[1])
if first_argument_is_help && second_argument_is_subcommand
help, subcommand = ARGV.shift(2)
ARGV.unshift(subcommand, help)
end
super
end
|
Instance Method Details
#migrate(source_email, destination_email) ⇒ Object
127
128
129
130
|
# File 'lib/imap/backup/cli.rb', line 127
def migrate(source_email, destination_email)
non_logging_options = Imap::Backup::Logger.setup_logging(options)
Migrate.new(source_email, destination_email, **non_logging_options).run
end
|
#mirror(source_email, destination_email) ⇒ Object
177
178
179
180
|
# File 'lib/imap/backup/cli.rb', line 177
def mirror(source_email, destination_email)
non_logging_options = Imap::Backup::Logger.setup_logging(options)
Mirror.new(source_email, destination_email, **non_logging_options).run
end
|
#restore(email = nil) ⇒ Object
194
195
196
197
|
# File 'lib/imap/backup/cli.rb', line 194
def restore(email = nil)
non_logging_options = Imap::Backup::Logger.setup_logging(options)
Restore.new(email, non_logging_options).run
end
|
#stats(email) ⇒ Object
227
228
229
230
|
# File 'lib/imap/backup/cli.rb', line 227
def stats(email)
non_logging_options = Imap::Backup::Logger.setup_logging(options)
Stats.new(email, non_logging_options).run
end
|
#version ⇒ Object
236
237
238
|
# File 'lib/imap/backup/cli.rb', line 236
def version
Kernel.puts "imap-backup #{Imap::Backup::VERSION}"
end
|