Class: WGif::CLI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



11
12
13
# File 'lib/wgif/cli.rb', line 11

def initialize
  @argument_parser = WGif::ArgumentParser.new
end

Instance Attribute Details

#argument_parserObject

Returns the value of attribute argument_parser.



9
10
11
# File 'lib/wgif/cli.rb', line 9

def argument_parser
  @argument_parser
end

Instance Method Details

#make_gif(cli_args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/wgif/cli.rb', line 15

def make_gif(cli_args)
  WGif::Installer.new.run if cli_args[0] == 'install'
  load_dependencies
  rescue_errors do
    args = @argument_parser.parse(cli_args)
    frames = convert_video(args)
    GifMaker.new.make_gif(frames, args[:output], args[:dimensions])
    display_info(args) if args[:info]
    upload(args)  if args[:upload]
    preview(args) if args[:preview]
  end
end