module Forematter
Constants
- VERSION
Attributes
root_command[R]
Public Class Methods
add_command(cmd)
click to toggle source
# File lib/forematter.rb, line 42 def add_command(cmd) root_command.add_command(cmd) end
run(args)
click to toggle source
attr_accessor :verbose
# File lib/forematter.rb, line 35 def run(args) # Remove the signal trap we set in the bin file. Signal.trap('INT', 'DEFAULT') setup root_command.run(args) end
Protected Class Methods
cmd_filenames()
click to toggle source
# File lib/forematter.rb, line 60 def cmd_filenames Dir[File.dirname(__FILE__) + '/forematter/commands/*.rb'] end
load_command_at(filename, command_name = nil)
click to toggle source
# File lib/forematter.rb, line 64 def load_command_at(filename, command_name = nil) Cri::Command.define(File.read(filename), filename).modify do name command_name || File.basename(filename, '.rb') auto_usage end end
setup()
click to toggle source
# File lib/forematter.rb, line 48 def setup root_cmd_filename = File.dirname(__FILE__) + '/forematter/commands/fore.rb' # Add help and root commands @root_command = load_command_at(root_cmd_filename) add_command(Cri::Command.new_basic_help) cmd_filenames.each do |filename| add_command(load_command_at(filename)) unless filename == root_cmd_filename end end