bini 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bini/prompts.rb +25 -0
- data/lib/bini/version.rb +1 -1
- metadata +5 -4
data/lib/bini/prompts.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# This is originally from: https://gist.github.com/2040373
|
2
|
+
|
3
|
+
module Bini
|
4
|
+
# A few prompts I may need in making CLI's.
|
5
|
+
module Prompts
|
6
|
+
extend self
|
7
|
+
def ask(*params)
|
8
|
+
params = params[0] if params[0]
|
9
|
+
raise RuntimeError, 'No interactive terminal present.' unless $stdin.tty?
|
10
|
+
if params[:prompt]
|
11
|
+
$stderr.print params[:prompt]
|
12
|
+
$stderr.flush
|
13
|
+
end
|
14
|
+
if params[:password]
|
15
|
+
raise RuntimeError 'Could not disable echo to ask for password security' unless system 'stty -echo -icanon'
|
16
|
+
end
|
17
|
+
output = $stdin.gets
|
18
|
+
output.chomp! if output
|
19
|
+
#unmuck the prompt.
|
20
|
+
`stty echo icanon`
|
21
|
+
output
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/lib/bini/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bini
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
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-11-
|
12
|
+
date: 2012-11-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sys-proctable
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/bini/filemagic.rb
|
49
49
|
- lib/bini/mixins.rb
|
50
50
|
- lib/bini/optparser.rb
|
51
|
+
- lib/bini/prompts.rb
|
51
52
|
- lib/bini/sash.rb
|
52
53
|
- lib/bini/version.rb
|
53
54
|
- spec/bini_spec.rb
|
@@ -71,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
72
|
version: '0'
|
72
73
|
segments:
|
73
74
|
- 0
|
74
|
-
hash: -
|
75
|
+
hash: -581091682006893014
|
75
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
77
|
none: false
|
77
78
|
requirements:
|
@@ -80,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
81
|
version: '0'
|
81
82
|
segments:
|
82
83
|
- 0
|
83
|
-
hash: -
|
84
|
+
hash: -581091682006893014
|
84
85
|
requirements: []
|
85
86
|
rubyforge_project:
|
86
87
|
rubygems_version: 1.8.21
|