Sha256: bafb495165f5cf952272f44ad928ff52862503733ffe2760d637fe41334cc034
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
# -*- coding: utf-8 -*- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net> require_relative '../base/subcmd' class Trepan::Subcommand::ShowMacro < Trepan::Subcommand unless defined?(HELP) Trepanning::Subcommand.set_name_prefix(__FILE__, self) HELP = "Show defined macros" MIN_ABBREV = 'ma'.size end def run(args) if args.size > 2 args[2..-1].each do |macro_name| if @proc.macros.member?(macro_name) msg "%s: %s" % [macro_name, @proc.macros[macro_name]] else msg "%s is not a defined macro" % macro_name end end elsif @proc.macros.empty? msg "No macros defined." else msg columnize_commands(@proc.macros.keys.sort) end end end if __FILE__ == $0 # Demo it. require_relative '../../mock' # FIXME: DRY the below code dbgr, cmd = MockDebugger::setup('show') subcommand = Trepan::Subcommand::ShowMacro.new(cmd) testcmdMgr = Trepan::Subcmd.new(subcommand) name = File.basename(__FILE__, '.rb') subcommand.summary_help(name) subcommand.run(%W(show #{name})) subcommand.run(%W(show #{name} u foo)) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trepanning-0.1.0 | processor/command/show_subcmd/macro.rb |