summaryrefslogtreecommitdiff
path: root/controllers/interfaces/cli.rb
diff options
context:
space:
mode:
authoricebaker <113217272+icebaker@users.noreply.github.com>2023-05-13 11:30:12 -0300
committerGitHub <noreply@github.com>2023-05-13 11:30:12 -0300
commitf52b8f3c73d53d4fe6faa1d4670194d3c6c6d992 (patch)
tree02aac93f5d618c2965973b2390de3adabf21be25 /controllers/interfaces/cli.rb
parent805e5073117bc717f46da0fa7f8ab628b4fa2a7d (diff)
parent680d55dbea3c8aec5049bd387aadaf31a443c8fd (diff)
Merge pull request #1 from icebaker/ib-streams
Improving Streams
Diffstat (limited to 'controllers/interfaces/cli.rb')
-rw-r--r--controllers/interfaces/cli.rb34
1 files changed, 27 insertions, 7 deletions
diff --git a/controllers/interfaces/cli.rb b/controllers/interfaces/cli.rb
index 3574a80..2a93044 100644
--- a/controllers/interfaces/cli.rb
+++ b/controllers/interfaces/cli.rb
@@ -13,20 +13,38 @@ module NanoBot
puts NanoBot::GEM[:version]
exit
when 'help', '', nil
+ puts ''
puts "Nano Bots #{NanoBot::GEM[:version]}"
- puts ' nb cartridge.yml - eval "Hello"'
+ puts ''
+ puts ' nb - - eval "hello"'
+ puts ' nb - - repl'
+ puts ''
+ puts ' nb cartridge.yml - eval "hello"'
puts ' nb cartridge.yml - repl'
- puts ' nb cartridge.yml - debug'
- puts ' nb cartridge.yml STATE-KEY eval "Hello"'
+ puts ''
+ puts ' nb - STATE-KEY eval "hello"'
+ puts ' nb - STATE-KEY repl'
+ puts ''
+ puts ' nb cartridge.yml STATE-KEY eval "hello"'
puts ' nb cartridge.yml STATE-KEY repl'
- puts ' nb cartridge.yml STATE-KEY debug'
+ puts ''
+ puts ' nb - - cartridge'
+ puts ' nb cartridge.yml - cartridge'
+ puts ''
+ puts ' nb - STATE-KEY state'
+ puts ' nb cartridge.yml STATE-KEY state'
+ puts ''
puts ' nb version'
+ puts ' nb help'
+ puts ''
exit
end
params = { cartridge_path: ARGV[0], state: ARGV[1], command: ARGV[2] }
- bot = Instance.new(cartridge_path: params[:cartridge_path], state: params[:state])
+ bot = Instance.new(
+ cartridge_path: params[:cartridge_path], state: params[:state], stream: $stdout
+ )
case params[:command]
when 'eval'
@@ -35,8 +53,10 @@ module NanoBot
bot.eval(params[:input])
when 'repl'
bot.repl
- when 'debug'
- bot.debug
+ when 'state'
+ bot.state
+ when 'cartridge'
+ bot.cartridge
else
raise "TODO: [#{params[:command]}]"
end