Sha256: 13e5ee96a9173f6b3e67df41bcee396fafefde8a1750592c96e0d85b0634ee90
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
module Log2mail module Console::Commands class <<self def desc(description) @desc = description end def method_added(meth) @@meths ||= [] meth = meth.to_s @@meths << [meth.gsub('_', ' '), @desc] if @desc # puts "Added method #{meth}. Desc: #{@desc.inspect}." # puts @@meths.inspect # meth # super end end protected def commands @@meths.map { |m| m.first.gsub(' ', '_') } end public desc "show list of available commands" def help @command_table ||= Terminal::Table.new :headings => ['command','description'], :rows => @@meths.sort puts @command_table true end desc "end console session" def quit; end def exit; end desc "show configuration" def config config_path = ask('configuration path? ').chomp config = Log2mail::Config::ConfigFileHandler.parse_config config_path puts "Defaults:" puts config.defaults puts "Settings:" puts config.formatted(false) puts "Effective settings:" puts config.formatted(true) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
log2mail-0.0.1.pre4 | lib/log2mail/console/commands.rb |