Class: Textlint::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/textlint/cli.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  stdio: false,
  paths: []
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Cli

Returns a new instance of Cli.

Parameters:

  • argv (Array)

    ARGV



20
21
22
23
# File 'lib/textlint/cli.rb', line 20

def initialize(argv)
  @options = DEFAULT_OPTIONS.dup
  parse_options(argv)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/textlint/cli.rb', line 7

def options
  @options
end

Class Method Details

.run(argv) ⇒ Object

Parameters:

  • argv (Array)

    ARGV



15
16
17
# File 'lib/textlint/cli.rb', line 15

def self.run(argv)
  new(argv).run
end

Instance Method Details

#runvoid

This method returns an undefined value.

Run textlint-ruby



28
29
30
31
32
33
34
# File 'lib/textlint/cli.rb', line 28

def run
  if @options[:stdio]
    run_stdio_server
  else
    run_file_parser
  end
end