Class: DeadFinder::CLI
- Inherits:
-
Thor
- Object
- Thor
- DeadFinder::CLI
- Defined in:
- lib/deadfinder/cli.rb
Overview
CLI class for handling command-line interactions
Class Method Summary collapse
Instance Method Summary collapse
- #completion(shell) ⇒ Object
- #file(filename) ⇒ Object
- #pipe ⇒ Object
- #sitemap(sitemap) ⇒ Object
- #url(url) ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
31 32 33 |
# File 'lib/deadfinder/cli.rb', line 31 def self.exit_on_failure? true end |
Instance Method Details
#completion(shell) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/deadfinder/cli.rb', line 64 def completion(shell) unless %w[bash zsh fish].include?(shell) DeadFinder::Logger.error "Unsupported shell: #{shell}" return end case shell when 'bash' puts DeadFinder::Completion.bash when 'zsh' puts DeadFinder::Completion.zsh when 'fish' puts DeadFinder::Completion.fish end end |
#file(filename) ⇒ Object
43 44 45 46 47 |
# File 'lib/deadfinder/cli.rb', line 43 def file(filename) opts = .dup opts['coverage'] = true if opts['visualize'] && !opts['visualize'].empty? DeadFinder.run_file filename, opts end |
#pipe ⇒ Object
36 37 38 39 40 |
# File 'lib/deadfinder/cli.rb', line 36 def pipe opts = .dup opts['coverage'] = true if opts['visualize'] && !opts['visualize'].empty? DeadFinder.run_pipe opts end |
#sitemap(sitemap) ⇒ Object
57 58 59 60 61 |
# File 'lib/deadfinder/cli.rb', line 57 def sitemap(sitemap) opts = .dup opts['coverage'] = true if opts['visualize'] && !opts['visualize'].empty? DeadFinder.run_sitemap sitemap, opts end |
#url(url) ⇒ Object
50 51 52 53 54 |
# File 'lib/deadfinder/cli.rb', line 50 def url(url) opts = .dup opts['coverage'] = true if opts['visualize'] && !opts['visualize'].empty? DeadFinder.run_url url, opts end |
#version ⇒ Object
80 81 82 |
# File 'lib/deadfinder/cli.rb', line 80 def version DeadFinder::Logger.info "deadfinder #{DeadFinder::VERSION}" end |