Class: YARD::CLI::Config

Inherits:
Command show all
Defined in:
lib/yard/cli/config.rb

Overview

CLI command to view or edit configuration options

Since:

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Command

#common_options, #load_script, #parse_options, run

Constructor Details

- (Config) initialize

Returns a new instance of Config

Since:

  • 0.6.2



21
22
23
24
25
26
27
28
# File 'lib/yard/cli/config.rb', line 21

def initialize
  super
  self.key = nil
  self.values = []
  self.reset = false
  self.append = false
  self.as_list = false
end

Instance Attribute Details

- (Boolean) append

Returns whether to append values to existing key

Returns:

  • (Boolean)

    whether to append values to existing key

Since:

  • 0.6.2



19
20
21
# File 'lib/yard/cli/config.rb', line 19

def append
  @append
end

- (Boolean) as_list

Returns whether the value being set should be inside a list

Returns:

  • (Boolean)

    whether the value being set should be inside a list

Since:

  • 0.6.2



16
17
18
# File 'lib/yard/cli/config.rb', line 16

def as_list
  @as_list
end

- (Symbol?) key

Returns the key to view/edit, if any

Returns:

  • (Symbol, nil)

    the key to view/edit, if any

Since:

  • 0.6.2



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

def key
  @key
end

- (Boolean) reset

Returns whether to reset the #key

Returns:

  • (Boolean)

    whether to reset the #key

Since:

  • 0.6.2



13
14
15
# File 'lib/yard/cli/config.rb', line 13

def reset
  @reset
end

- (Array?) values

Returns the list of values to set (or single value), if modifying

Returns:

  • (Array, nil)

    the list of values to set (or single value), if modifying

Since:

  • 0.6.2



10
11
12
# File 'lib/yard/cli/config.rb', line 10

def values
  @values
end

Instance Method Details

- (Object) description

Since:

  • 0.6.2



30
31
32
# File 'lib/yard/cli/config.rb', line 30

def description
  'Views or edits current global configuration'
end

- (Object) run(*args)

Since:

  • 0.6.2



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/yard/cli/config.rb', line 34

def run(*args)
  optparse(*args)
  if key
    if reset || values.size > 0
      modify_item
    else
      view_item
    end
  else
    list_configuration
  end
end