console-glitter 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35359b167d5fc44cafe9e843dd060b3900c0418a
4
- data.tar.gz: c043bf60e55066b38fb29d66b35ff73a98760688
3
+ metadata.gz: baf523bf1aeebc54f79df59d20d85caf0562e5a3
4
+ data.tar.gz: 519b75adaec42c3ac17b6d51a48998e50944a8cb
5
5
  SHA512:
6
- metadata.gz: 72fc3bd34076a13c00ccac84de1f8f3c0c773641148bc641b1564078804ae6362f0748a65746d57a6a2f55d7e7fadb0a830de5a973bad46a28c6277a4ec9c796
7
- data.tar.gz: e44c586609d2c657651f4a0920bead4b1d5d7fac043ef0b816e35a95cfbb4935d5e39a9a9e3899a3d4a4c901e81a6628f99c6bfb224c8a72ce1dd9be3957411f
6
+ metadata.gz: b95ffb8053587a36bfb8f7924beafe4b6684ace0886ad7e42e712d45cfc4a056ebb79c6c87f8fa2e9c8bdc42d0504d50ef664b713942251baf038fd73dbc0cb8
7
+ data.tar.gz: 8b7e398bf8389fecf839b885d67fb13128abb153a6a4f7afb298d542c3b67808ab17f5cd43f80bc217fc59a0b00b172915b9dba48906c20ac3d60d736c94ffb9
@@ -1,3 +1,3 @@
1
1
  module ConsoleGlitter
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'console-glitter/version'
2
2
  require 'console-glitter/ansi'
3
+ require 'io/console'
3
4
 
4
5
  module ConsoleGlitter
5
6
  module UI extend self
@@ -61,6 +62,33 @@ module ConsoleGlitter
61
62
  /^n/i.match(prompt(question, args)).nil?
62
63
  end
63
64
 
65
+ # Public: Wrap Console#prompt, disabling local echo of user input.
66
+ #
67
+ # question - Query to be presented to the user.
68
+ # options - Hash containing arguments defining acceptable responses.
69
+ # (default: {}):
70
+ # :default_answer - String containing the default answer. If
71
+ # this is nil, a non-empty answer MUST be
72
+ # given.
73
+ # :allow_empty - Whether or not to allow empty responses.
74
+ # Unless explicitly allowed, empty answers
75
+ # will be rejected.
76
+ # :valid_answers - An Array containing all valid responses. If
77
+ # this is empty, any answer will be accepted
78
+ # (unless empty answers are disallowed as
79
+ # specified above). Valid responses may be
80
+ # any class with a match method such as
81
+ # Strings or Regexps.
82
+ #
83
+ # Returns a String containing the answer provided by the user.
84
+ def secure_prompt(question, args = {})
85
+ IO.console.echo = false
86
+ prompt(question, args)
87
+ ensure
88
+ IO.console.echo = true
89
+ puts
90
+ end
91
+
64
92
  # Public: Render a "spinner" on the command line and yield to a block,
65
93
  # reporting success if nothing is raised, or else reporting failure.
66
94
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console-glitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wuest
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-17 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Tools for building nice looking CLI applications
14
14
  email: chris@chriswuest.com