From ff35b0bdce9f87b5b4603bd8acc94a7b2a363ffa Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Wed, 8 May 2024 14:31:31 +0100 Subject: Fix i command --- forward-please | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'forward-please') diff --git a/forward-please b/forward-please index 69f5dd1..dcd7f75 100755 --- a/forward-please +++ b/forward-please @@ -11,8 +11,6 @@ end $level = $levels.shift -puts $level.description - def help puts <<~EOF Commands: @@ -20,7 +18,6 @@ def help h: this help c: click on d: show the level description - i: show the interfaces a: show the click frames and actions q: quit EOF @@ -34,15 +31,19 @@ end def clickactions puts "Click #{$click}:" - puts "Frames:" + + puts " Interfaces:" + puts " #{$level.interfaces.join(", ")}" + + puts " Frames:" $clickframes.each do |id, frame| - puts " #{id}: #{frame.description} from Interface #{frame.iface}" + puts " #{id}: #{frame.description} from Interface #{frame.iface}" end i = 1 - puts "Actions:" + puts " Actions:" $instructions.each do |instr| - puts " #{i}: Forward frame #{instr[0]} to interface #{instr[1].iface}" + puts " #{i}: Forward frame #{instr[0]} to interface #{instr[1].iface}" end end @@ -82,7 +83,9 @@ def click puts "Demo all done" exit 0 end + puts puts $level.description + puts end $clickframes = $level.generate @@ -102,8 +105,6 @@ def handle(cmd) end when ?d puts $level.description - when ?i - puts $level.interfaces when ?a clickactions when ?c @@ -113,9 +114,12 @@ def handle(cmd) end end -$clickframes = $level.generate +puts $level.description +puts +$clickframes = $level.generate clickactions + loop do print ">: " handle(gets.strip) -- cgit v1.2.1