Class: Ergane::Tool
Instance Attribute Summary
Attributes inherited from Command
#options
Class Method Summary
collapse
dsl_value
Methods inherited from Command
#abbreviate_path, #args, argument_required?, command_name, command_name=, #initialize, #run, subcommands, terms
#aliases, #argument, #command, #flag, #option
included
included
Class Method Details
.command_class(klass = nil) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/ergane/tool.rb', line 12
def command_class(klass = nil)
if klass
@command_class = klass
wire_command_class(klass)
else
@command_class
end
end
|
.inherited(subclass) ⇒ Object
41
42
43
44
|
# File 'lib/ergane/tool.rb', line 41
def inherited(subclass)
super
create_command_base(subclass) if self == Tool
end
|
.load_commands(*patterns) ⇒ Object
35
36
37
38
39
|
# File 'lib/ergane/tool.rb', line 35
def load_commands(*patterns)
patterns.flatten.each do |pattern|
Dir[pattern].sort.each { |file| require file }
end
end
|
.start(argv = ARGV) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/ergane/tool.rb', line 25
def start(argv = ARGV)
Runner.new(self, argv.dup).execute
rescue Interrupt
$stderr.puts "\nAborted."
exit 130
rescue Ergane::Error => e
$stderr.puts e.message
exit 1
end
|
21
22
23
|
# File 'lib/ergane/tool.rb', line 21
def tool_name(name = nil)
name ? (self.command_name = name) : command_name
end
|