Module: Vtt2ass

Defined in:
lib/vtt2ass/version.rb,
lib/vtt2ass.rb

Overview

Vtt2ass module to provide the version number

Constant Summary collapse

VERSION =

This is the version of the application. This needs to be changed for each gem release.

"0.2.9"

Class Method Summary collapse

Class Method Details

.mainObject

This function creates a new application instance and starts the process.

It also defines the arguments that can be provided from the CLI.



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
# File 'lib/vtt2ass.rb', line 13

def main
    options = {}

    OptionParser.new do |opts|
        opts.banner = "Usage: vtt2ass [options]"
        opts.separator ""
        opts.separator "Specific options:"
        opts.on("-i", "--input PATH", "Specify a custom input file or directory (default: './')") do |file_path|
            options[:input] = file_path
        end
        opts.on("-o", "--output PATH", "Specify a custom output directory (default: './')") do |file_path|
            options[:output] = file_path
        end
        opts.on("-f", "--font-family FONT", String, "Specify a font family for the subtitles (default: 'Open Sans Semibold')") do |font_family|
            options[:font_family] = font_family
        end
        opts.on("-s", "--font-size SIZE", Integer, "Specify a font size for the subtitles (default: 52)") do |font_size|
            options[:font_size] = font_size
        end
        opts.on("-t", "--title TITLE", String, "Specify a title for you file. If the input is a directory, all files will share the same title.") do |title|
            options[:title] = title
        end
        opts.on("-v", "--version", "Show version") do
            puts Vtt2ass::VERSION
            exit
        end
    end.parse!

    app = Application.new(options)
    app.start
end