class CTioga2::Commands::CommandGroup

A group of commands, organized along a same theme.

Attributes

blacklisted[RW]

Whether the group is blacklisted or not, ie whether the group's help text will be displayed at all.

commands[RW]

The commands belonging to the group

context[RW]

The context of definition [file, line]

description[RW]

A (longer) description of the group

id[RW]

A short, unique, codelike name for the group.

name[RW]

The name of the group

priority[RW]

The priority of the group. It influences the positioning of its command-line options in the –help display. Lower priorities come first.

Public Class Methods

new(id, name, desc = nil, priority = 0, blacklist = false, register = true) click to toggle source
# File lib/ctioga2/commands/groups.rb, line 48
def initialize(id, name, desc = nil, priority = 0, blacklist = false,
               register = true)
  @commands = []
  @name = name
  @id = id
  @description = desc || name
  @priority = priority
  @blacklisted = blacklist

  if register 
    Interpreter.register_group(self)
  end

  # The context in which the group was defined
  caller[1].gsub(/.*\/ctioga2\//, 'lib/ctioga2/') =~ /(.*):(\d+)/
  @context = [$1, $2.to_i]
end