Class: RemLint::CLI
- Inherits:
-
Object
- Object
- RemLint::CLI
- Defined in:
- lib/remlint/cli.rb
Overview
The remlint command.
Streams are injected rather than assumed, so the whole command is testable
without shelling out or capturing $stdout.
Defined Under Namespace
Classes: Options
Constant Summary collapse
- EXIT_SUCCESS =
0- EXIT_OFFENSES =
1- EXIT_USAGE =
2- DEFAULT_PATHS =
["."].freeze
Instance Attribute Summary collapse
-
#err ⇒ Object
readonly
Returns the value of attribute err.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Instance Method Summary collapse
- #call(argv) ⇒ Object
-
#initialize(out: $stdout, err: $stderr) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize(out: $stdout, err: $stderr) ⇒ CLI
Returns a new instance of CLI.
34 35 36 37 |
# File 'lib/remlint/cli.rb', line 34 def initialize(out: $stdout, err: $stderr) @out = out @err = err end |
Instance Attribute Details
#err ⇒ Object (readonly)
Returns the value of attribute err.
32 33 34 |
# File 'lib/remlint/cli.rb', line 32 def err @err end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
32 33 34 |
# File 'lib/remlint/cli.rb', line 32 def out @out end |
Instance Method Details
#call(argv) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/remlint/cli.rb', line 39 def call(argv) = Options.new( paths: [], config_path: nil, only: nil, format: Formatter::DEFAULT_TEMPLATE, fail_level: "warning", ) dispatch(parse(argv, ), ) rescue OptionParser::ParseError => error err.puts(error.) EXIT_USAGE end |