Class: Snapshooter::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/snapshooter/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



9
10
11
12
13
14
15
16
# File 'lib/snapshooter/cli.rb', line 9

def initialize
  @options = {
    :storage => :local,
    :id      => Time.now.to_i,
    :restore => false
  }
  @options.merge! parse_options
end

Class Method Details

.startObject



5
6
7
# File 'lib/snapshooter/cli.rb', line 5

def self.start
  new.run
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
# File 'lib/snapshooter/cli.rb', line 18

def run
  shooter = Base.new(@options[:id], @options[:storage])
  if @options[:restore]
    shooter.restore
  else
    shooter.snapshot!
  end
end