prompt 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/examples/guess.rb ADDED
@@ -0,0 +1,12 @@
1
+ require 'prompt'
2
+ extend Prompt::DSL
3
+
4
+ param :num do
5
+ (1..10).to_a
6
+ end
7
+
8
+ command "guess :num" do |num|
9
+ puts "you guessed #{num}"
10
+ end
11
+
12
+ Prompt::Console.start
@@ -23,7 +23,7 @@ module Prompt
23
23
  @values
24
24
  end
25
25
 
26
- all.grep /^#{starting_with}/
26
+ all.map(&:to_s).grep /^#{starting_with}/
27
27
  end
28
28
 
29
29
  end
@@ -1,5 +1,5 @@
1
1
  module Prompt
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
 
4
4
  class << self
5
5
 
@@ -161,6 +161,14 @@ describe Prompt::Command do
161
161
  c.completions(1, "v").should == ['very fast']
162
162
  end
163
163
 
164
+ it "expand correctly if parameter values are not strings" do
165
+ nums = Parameter.new(:numbers, "", [1, 2, 3, 10])
166
+ c = Command.new(["guess", matcher(nums)])
167
+ c.completions(1, "1").should == ["1", "10"]
168
+ c.completions(1, "2").should == ["2"]
169
+ c.completions(1, "9").should == []
170
+ end
171
+
164
172
  it "expands correctly when *param is followed by :param" do
165
173
  speed = Parameter.new(:speed, "", SPEEDS)
166
174
  dir = Parameter.new(:dir, "", DIRECTIONS)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prompt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-21 00:00:00.000000000 Z
12
+ date: 2012-06-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Prompt makes it easy to build slick command-line applications with tab
15
15
  completion, command history, and built-in help
@@ -40,6 +40,7 @@ files:
40
40
  - spec/prompt/console_spec.rb
41
41
  - spec/spec_helper.rb
42
42
  - examples/file_manager
43
+ - examples/guess.rb
43
44
  - examples/mud
44
45
  homepage: http://github.com/mudynamics/prompt
45
46
  licenses: []
@@ -61,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
62
  version: '0'
62
63
  requirements: []
63
64
  rubyforge_project:
64
- rubygems_version: 1.8.11
65
+ rubygems_version: 1.8.23
65
66
  signing_key:
66
67
  specification_version: 3
67
68
  summary: A micro framework that makes it easy to build slick command-line applications