Method: Html2rss::CLI#feed

Defined in:
lib/html2rss/cli.rb

#feed(yaml_file, *options) ⇒ nil

Prints the feed to STDOUT.

Parameters:

  • yaml_file (String)

    Path to the YAML configuration file.

  • options (Array<String>)

    Additional options including feed name and parameters.

Returns:

  • (nil)

25
26
27
28
29
30
31
32
# File 'lib/html2rss/cli.rb', line 25

def feed(yaml_file, *options)
  raise "File '#{yaml_file}' does not exist" unless File.exist?(yaml_file)

  feed_name = options.shift unless options.first&.include?('=')
  params = options.to_h { |opt| opt.split('=', 2) }

  puts Html2rss.feed_from_yaml_config(yaml_file, feed_name, params:)
end