Class: TodoLint::Cli
- Inherits:
-
Object
- Object
- TodoLint::Cli
- Defined in:
- lib/todo_lint/cli.rb
Overview
Here we bring together all the pieces and see if it comes together
Instance Method Summary collapse
-
#initialize(args) ⇒ Cli
constructor
Startup the thing that actually checks the files for todos!.
-
#load_files(file_finder) ⇒ Array<String>
Loads the files to be read.
-
#run! ⇒ Object
Perform the actions requested based on the options specified.
Constructor Details
#initialize(args) ⇒ Cli
Startup the thing that actually checks the files for todos!
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/todo_lint/cli.rb', line 10 def initialize(args) # rubocop:disable @options = Options.new.parse(args) if @options[:config_file] @options.merge!(ConfigFile.new.read_config_file(@options[:config_file])) elsif File.exist?("./.todo_lint.yml") @options.merge!(ConfigFile.new.read_config_file("./.todo_lint.yml")) end @path = File.(".") add_default_extensions unless @options.fetch(:files, []).any? end |
Instance Method Details
#load_files(file_finder) ⇒ Array<String>
Loads the files to be read
39 40 41 42 43 44 45 |
# File 'lib/todo_lint/cli.rb', line 39 def load_files(file_finder) if file_finder..fetch(:files).empty? file_finder.list(*[:extensions]) else file_finder..fetch(:files, []) end end |
#run! ⇒ Object
Perform the actions requested based on the options specified
27 28 29 30 31 32 33 |
# File 'lib/todo_lint/cli.rb', line 27 def run! if [:report] print_report else lint_codebase end end |