Class: CLIApp::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, desc: nil, version: nil, command: nil, help_indent: nil, help_option_width: nil, help_action_width: nil, actionlist_width: nil, actionlist_format: nil) ⇒ Config

Returns a new instance of Config.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/cliapp.rb', line 56

def initialize(name: nil, desc: nil, version: nil, command: nil,
               help_indent: nil, help_option_width: nil, help_action_width: nil,
               actionlist_width: nil, actionlist_format: nil)
  command ||= File.basename($0)
  @name    = name || command     # ex: "FooBar"
  @desc    = desc                # ex: "Foo Bar application"
  @command = command             # ex: "foobar"
  @version = version             # ex: "1.0.0"
  @help_indent        = help_indent        || "  "
  @help_option_width  = help_option_width  || 22
  @help_action_width  = help_action_width  || 22
  @actionlist_width   = actionlist_width   || 16
  @actionlist_format  = actionlist_format  || nil # ex: "%-16s : %s"
end

Instance Attribute Details

#actionlist_formatObject

Returns the value of attribute actionlist_format.



73
74
75
# File 'lib/cliapp.rb', line 73

def actionlist_format
  @actionlist_format
end

#actionlist_widthObject

Returns the value of attribute actionlist_width.



73
74
75
# File 'lib/cliapp.rb', line 73

def actionlist_width
  @actionlist_width
end

#commandObject

Returns the value of attribute command.



71
72
73
# File 'lib/cliapp.rb', line 71

def command
  @command
end

#descObject

Returns the value of attribute desc.



71
72
73
# File 'lib/cliapp.rb', line 71

def desc
  @desc
end

#help_action_widthObject

Returns the value of attribute help_action_width.



72
73
74
# File 'lib/cliapp.rb', line 72

def help_action_width
  @help_action_width
end

#help_indentObject

Returns the value of attribute help_indent.



72
73
74
# File 'lib/cliapp.rb', line 72

def help_indent
  @help_indent
end

#help_option_widthObject

Returns the value of attribute help_option_width.



72
73
74
# File 'lib/cliapp.rb', line 72

def help_option_width
  @help_option_width
end

#nameObject

Returns the value of attribute name.



71
72
73
# File 'lib/cliapp.rb', line 71

def name
  @name
end

#versionObject

Returns the value of attribute version.



71
72
73
# File 'lib/cliapp.rb', line 71

def version
  @version
end