Class: Subfinder::Parser::Args

Inherits:
Object
  • Object
show all
Defined in:
lib/subfinder/parser/args.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Args

Returns a new instance of Args.



4
5
6
7
8
# File 'lib/subfinder/parser/args.rb', line 4

def initialize(args)
  @args = args
  parse_args
  validate_required_args
end

Instance Method Details

#parse_argsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/subfinder/parser/args.rb', line 10

def parse_args
  opts = OptionParser.new
  opts.banner = usage_msg
  opts.separator ''
  opts.separator 'options:'
  opts.on('-u', '--url url', 'Set subscene url page') { |url| Config.url = url }
  opts.on('-l', '--language language', 'Set subtitle language') { |language| Config.language = language }
  opts.on('-v', '--version', 'Show the Compare Crypto version') { puts("Subfinder #{Subfinder::VERSION}"); exit }
  opts.on('-h', '--help', 'Show this message') { puts(opts); exit }
  opts.on('-d', '--debug', 'debug') { Config.debug = true }

  opts.parse!(@args)
end