README.md in simple_console-0.0.2 vs README.md in simple_console-0.0.3
- old
+ new
@@ -5,11 +5,11 @@
## Installation
Add this line to your application's Gemfile:
```ruby
-gem 'console', github: 'xjz19901211/console'
+gem 'console'
```
And then execute:
$ bundle
@@ -25,10 +25,15 @@
include Console
define_cmd(:rand, "puts random number") do |max = 100|
puts rand(max.to_i)
end
+
+ define_cmd(:incr, "increment number") do |incrby = 1|
+ @number ||= 0
+ puts @number += incrby.to_i
+ end
end
MyConsole.new.start("my-console > ", "Use 'help' show all commands")
```
@@ -37,15 +42,22 @@
Use 'help' show all commands
my-console > help
help: show all commands
exit: exit console
rand: puts random number
+ incr: increment number
my-console > rand
23
my-console > rand 10
4
my-console > rand 10100
2492
+my-console > incr
+1
+my-console > incr 3
+4
+my-console > incr
+5
my-console > exit
$
```