Class: Html2rss::CLI
- Inherits:
-
Thor
- Object
- Thor
- Html2rss::CLI
- Defined in:
- lib/html2rss/cli.rb
Overview
The Html2rss command line interface.
Class Method Summary collapse
Instance Method Summary collapse
- #auto(url) ⇒ Object
-
#feed(yaml_file, *options) ⇒ nil
Prints the feed to STDOUT.
Class Method Details
permalink .exit_on_failure? ⇒ Boolean
14 15 16 |
# File 'lib/html2rss/cli.rb', line 14 def self.exit_on_failure? true end |
Instance Method Details
permalink #auto(url) ⇒ Object
[View source]
40 41 42 43 44 |
# File 'lib/html2rss/cli.rb', line 40 def auto(url) strategy = .fetch(:strategy) { RequestService.default_strategy_name }.to_sym puts Html2rss.auto_source(url, strategy:) end |
permalink #feed(yaml_file, *options) ⇒ nil
Prints the feed to STDOUT.
25 26 27 28 29 30 31 32 |
# File 'lib/html2rss/cli.rb', line 25 def feed(yaml_file, *) raise "File '#{yaml_file}' does not exist" unless File.exist?(yaml_file) feed_name = .shift unless .first&.include?('=') params = .to_h { |opt| opt.split('=', 2) } puts Html2rss.feed_from_yaml_config(yaml_file, feed_name, params:) end |