question 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/README.md +2 -16
- data/Rakefile +0 -1
- data/examples/example.rb +4 -0
- data/lib/question/list.rb +2 -2
- data/lib/question/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83f901591d98f8a0534d70563b276c204bbe4451
|
4
|
+
data.tar.gz: e0e3997370cd08a073a09022c742e4155516d40c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fa04fab0bbd57cecd148baaea5049136816bacffdfdfc9e69e393630044ac8651ef52eaf50aa219e19047519a6a43f84f68f2342b35ef9fc5183c54305dad2c
|
7
|
+
data.tar.gz: 114a80ff4b12e5001a58b7a3fc3787a7de8cfdaa797615bca519e0f69ce4f569488e76e0768c9235fbb4e7b826c8396952bd13698f4530ddedb83a9c0e16dd24
|
data/.gitignore
CHANGED
@@ -1 +1 @@
|
|
1
|
-
/
|
1
|
+
/pkg
|
data/README.md
CHANGED
@@ -1,22 +1,8 @@
|
|
1
1
|
# Question
|
2
2
|
|
3
|
-
|
3
|
+
UI elements for cli apps (inspired by [Inquirer.js](https://github.com/SBoudrias/Inquirer.js/))
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
![http://cl.ly/image/3h1G1a1S3X0A/Image%202015-01-14%20at%2012.51.16%20PM.png](http://cl.ly/image/3h1G1a1S3X0A/Image%202015-01-14%20at%2012.51.16%20PM.png)
|
8
|
-
|
9
|
-
### List
|
10
|
-
![http://cl.ly/image/0s1E0S2f0c3M/Image%202015-01-14%20at%2012.51.45%20PM.png](http://cl.ly/image/0s1E0S2f0c3M/Image%202015-01-14%20at%2012.51.45%20PM.png)
|
11
|
-
|
12
|
-
### Input
|
13
|
-
![http://cl.ly/image/1c3i2d3e3z2v/Image%202015-01-14%20at%2012.52.01%20PM.png](http://cl.ly/image/1c3i2d3e3z2v/Image%202015-01-14%20at%2012.52.01%20PM.png)
|
14
|
-
|
15
|
-
### Confirm
|
16
|
-
![http://cl.ly/image/2H0e101H1q3W/Image%202015-01-14%20at%2012.52.26%20PM.png](http://cl.ly/image/2H0e101H1q3W/Image%202015-01-14%20at%2012.52.26%20PM.png)
|
17
|
-
|
18
|
-
### End Result
|
19
|
-
![https://s3.amazonaws.com/f.cl.ly/items/2K3w1Y0F2T2o1505191J/Image%202015-01-14%20at%2012.35.04%20PM.png](https://s3.amazonaws.com/f.cl.ly/items/2K3w1Y0F2T2o1505191J/Image%202015-01-14%20at%2012.35.04%20PM.png)
|
5
|
+
![cd616c38e4be55ddc71072b8e435bbc5](https://cloud.githubusercontent.com/assets/596/5765298/359651d0-9cad-11e4-8f32-8540b6ddf0c3.gif)
|
20
6
|
|
21
7
|
## Installation
|
22
8
|
|
data/Rakefile
CHANGED
data/examples/example.rb
CHANGED
@@ -10,7 +10,11 @@ choices = [
|
|
10
10
|
]
|
11
11
|
|
12
12
|
pp Question.checkbox_list("What colors do you like", choices, default: choices[1..-1])
|
13
|
+
puts
|
13
14
|
pp Question.list("What is your FAVORITE color", choices)
|
15
|
+
puts
|
14
16
|
pp Question.input("What is your name?", default: ENV["USER"])
|
17
|
+
puts
|
15
18
|
pp Question.password("Enter something secret")
|
19
|
+
puts
|
16
20
|
pp Question.confirm("Do you understand")
|
data/lib/question/list.rb
CHANGED
@@ -33,10 +33,10 @@ module Question
|
|
33
33
|
exit 130
|
34
34
|
when TTY::CODE::RETURN, TTY::CODE::SPACE
|
35
35
|
@finished = true
|
36
|
-
when TTY::CODE::DOWN
|
36
|
+
when TTY::CODE::DOWN, TTY::CODE::CTRL_J, TTY::CODE::CTRL_N
|
37
37
|
@active_index += 1
|
38
38
|
@active_index = 0 if @active_index >= @choices.length
|
39
|
-
when TTY::CODE::UP
|
39
|
+
when TTY::CODE::UP, TTY::CODE::CTRL_K, TTY::CODE::CTRL_P
|
40
40
|
@active_index -= 1
|
41
41
|
@active_index = @choices.length - 1 if @active_index < 0
|
42
42
|
end
|
data/lib/question/version.rb
CHANGED