9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/backup_repos/commander.rb', line 9
def run
program :name, 'Backup Repos'
program :version, BackupRepos::VERSION
program :description, 'Backup your repositories to specified directory.'
command :backup do |c|
c.syntax = 'backup-repos backup'
c.description = 'Backup your repositories.'
c.option '--backup_root DIR', String, 'Backup destination directory'
c.option '--debug', String, 'Show debug information'
c.action do |args, options|
BackupRepos.config_options = options
if args[0] && %w(github bitbucket gitlab).include?(args[0].downcase)
BackupRepos::Backup.new.send("process_#{args[0]}")
else
BackupRepos::Backup.new.process
end
end
end
command :setup do |c|
c.syntax = 'backup-repos setup'
c.description = 'Setup settings.'
c.option '--debug', String, 'Setup with debug flag.'
c.action do |_args, options|
BackupRepos::CLI::Setup.new(options).call
end
end
run!
end
|