controllers/interfaces/cli.rb in nano-bots-0.0.2 vs controllers/interfaces/cli.rb in nano-bots-0.0.3
- old
+ new
@@ -11,33 +11,53 @@
case ARGV[0]
when 'version'
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'
params[:input] = ARGV[3..]&.join(' ')
params[:input] = $stdin.read.chomp if params[:input].nil? || params[:input].empty?
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
end
end