1
# groups.rb: a group of commands
2
# copyright (c) 2009 by Vincent Fourmond
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details (in the COPYING file).
14
require 'ctioga2/utils'
15
require 'ctioga2/metabuilder/types'
19
Version::register_svn_info('$Revision: 14 $', '$Date: 2009-04-27 21:49:16 +0200 (Mon, 27 Apr 2009) $')
23
# A group of commands, organized along a same theme.
26
# The commands belonging to the group
27
attr_accessor :commands
29
# The name of the group
32
# A short, unique, codelike name for the group.
35
# A (longer) description of the group
36
attr_accessor :description
38
# The priority of the group. It influences the positioning of
39
# its command-line options in the --help display. Lower
40
# priorities come first.
41
attr_accessor :priority
43
# Whether the group is blacklisted or not, ie whether the group's
44
# help text will be displayed at all.
45
attr_accessor :blacklisted
47
# The context of definition [file, line]
48
attr_accessor :context
50
def initialize(id, name, desc = nil, priority = 0, blacklist = false,
55
@description = desc || name
57
@blacklisted = blacklist
60
Interpreter.register_group(self)
63
# The context in which the group was defined
64
caller[1].gsub(/.*\/ctioga2\//, 'lib/ctioga2/') =~ /(.*):(\d+)/
65
@context = [$1, $2.to_i]