Class: HTMLProofer::CLI
- Inherits:
-
Object
- Object
- HTMLProofer::CLI
- Defined in:
- lib/html_proofer/cli.rb
Overview
The CLI is a class responsible of handling all the command line interface logic.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run(args = ARGV) ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
9 10 11 |
# File 'lib/html_proofer/cli.rb', line 9 def initialize @options = {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/html_proofer/cli.rb', line 7 def @options end |
Instance Method Details
#run(args = ARGV) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/html_proofer/cli.rb', line 13 def run(args = ARGV) @options, path = HTMLProofer::Configuration.new.(args) paths = path.split(",") if @options[:as_links] links = path.split(",").map(&:strip) HTMLProofer.check_links(links, @options).run elsif File.directory?(paths.first) HTMLProofer.check_directories(paths, @options).run else HTMLProofer.check_file(path, @options).run end end |