madCLIbs 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -4
- data/examples/basic.rb +10 -2
- data/lib/mad_clibs/blanks/mixins/color_handling.rb +3 -1
- data/lib/mad_clibs/blanks/mixins/value_buffer_delegate.rb +1 -1
- data/lib/mad_clibs/prompter.rb +1 -1
- data/lib/mad_clibs/util/iohelper.rb +1 -0
- data/lib/mad_clibs/version.rb +1 -1
- data/madCLIbs.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6e4489abd1410baba0ed65e21de82b707ec9148
|
4
|
+
data.tar.gz: 61fb3e613fc43515672c173379e1264c197a39a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38c35fbd1232947ae63bc5eafc6867de5c7f78bb6e14760b2115cac1869c4421f7a5dc178ef8c72895b7f4d03b8a5b62782ce8d620d3db98e634d6975b80fd83
|
7
|
+
data.tar.gz: 7841306381833dca8616ba18e4645407396155f585cc2eccfe34a6195daf6b7a1b96249cfc46f48932abb5c60c7996b92233051666909cb8ffb0681c4a1ad88d
|
data/README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# MadCLI</tt>bs:<br> User-Friendly Fill-in-the-Blank(s) UX for your Terminal Application
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/madCLIbs.svg)](http://badge.fury.io/rb/madCLIbs) [![Code Climate](https://codeclimate.com/github/donaldguy/madCLIbs/badges/gpa.svg)](https://codeclimate.com/github/donaldguy/madCLIbs) [![Dependency Status](https://gemnasium.com/donaldguy/madCLIbs.svg)](https://gemnasium.com/donaldguy/madCLIbs)
|
3
|
+
|
2
4
|
|
3
5
|
Seeks to mimic the familiar UX of HTML5 form elements, with
|
4
6
|
[placeholders](http://diveintohtml5.info/forms.html#placeholder),
|
5
7
|
in the terminal.
|
6
8
|
|
7
|
-
Allows a program to present a line with one or more "blanks" which can be edited and
|
8
|
-
at will (with
|
9
|
-
placeholders as a default values)
|
9
|
+
Allows a program to present a line with one or more "blanks" which can be edited and cycled between
|
10
|
+
at will (with `Tab` & `Shift-Tab` or :arrow_up: & :arrow_down: keys). On `Return`/new line, returns the values of the blanks (treating placeholders as a default values if no editing occured)
|
10
11
|
|
11
12
|
The name is supposed to be Mad Libs with a CLI in it, but you might also
|
12
13
|
reasonably call it "Mad CLI BS" :smile:
|
@@ -17,7 +18,11 @@ pretty useful for things like [Dramaturg](https://github.com/donaldguy/dramaturg
|
|
17
18
|
|
18
19
|
## Usage
|
19
20
|
|
20
|
-
See [examples](https://github.com/donaldguy/madCLIbs/tree/master/examples)
|
21
|
+
See [examples](https://github.com/donaldguy/madCLIbs/tree/master/examples) for example code
|
22
|
+
|
23
|
+
Here's a quick UX demo
|
24
|
+
|
25
|
+
![Demo Gif](http://g.recordit.co/igWkgeP8wM.gif)
|
21
26
|
|
22
27
|
## Contributing
|
23
28
|
|
data/examples/basic.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
require 'madCLIbs/import'
|
2
|
+
require 'term/ansicolor'
|
2
3
|
|
4
|
+
include Term::ANSIColor
|
3
5
|
|
4
|
-
name, food = prompt("My name is",
|
6
|
+
name, food, side = prompt("My name is",
|
7
|
+
cyan(bold(string(ENV['USER']))),
|
8
|
+
"and I like",
|
9
|
+
bold(string("chicken")),
|
10
|
+
"with",
|
11
|
+
string(green("rice"))
|
12
|
+
)
|
5
13
|
|
6
|
-
puts "Your name is #{name} and you like #{food}"
|
14
|
+
puts "Your name is #{name} and you like #{food} with #{side}"
|
@@ -26,9 +26,11 @@ class MadClibs
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def save_and_remove_color(s)
|
29
|
+
@color_seed ||= '%{value}'
|
29
30
|
colored = s
|
30
31
|
uncolored = uncolor(s)
|
31
|
-
|
32
|
+
new_color_seed = colored.sub(%r'#{uncolored}', '%{value}')
|
33
|
+
@color_seed = new_color_seed % {value: @color_seed}
|
32
34
|
uncolored
|
33
35
|
end
|
34
36
|
|
data/lib/mad_clibs/prompter.rb
CHANGED
data/lib/mad_clibs/version.rb
CHANGED
data/madCLIbs.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |spec|
|
|
13
13
|
Seeks to mimic the familiar UX of HTML5 form elements, with placeholder attributes,
|
14
14
|
in an ANSI-compatible terminal.
|
15
15
|
|
16
|
-
Allows a program to present a line with one or more "blanks" which can be edited and
|
17
|
-
at will (with tab or up & down arrow keys). On new line, returns the values of the blanks (treating
|
16
|
+
Allows a program to present a line with one or more "blanks" which can be edited and cycled between
|
17
|
+
at will (with tab & shift-tab or up & down arrow keys). On new line, returns the values of the blanks (treating
|
18
18
|
placeholders as a default values if no editing occured)
|
19
19
|
EOS
|
20
20
|
spec.homepage = "https://github.com/donaldguy/madCLIbs"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: madCLIbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donald Guy
|
@@ -42,8 +42,8 @@ description: |2
|
|
42
42
|
Seeks to mimic the familiar UX of HTML5 form elements, with placeholder attributes,
|
43
43
|
in an ANSI-compatible terminal.
|
44
44
|
|
45
|
-
Allows a program to present a line with one or more "blanks" which can be edited and
|
46
|
-
at will (with tab or up & down arrow keys). On new line, returns the values of the blanks (treating
|
45
|
+
Allows a program to present a line with one or more "blanks" which can be edited and cycled between
|
46
|
+
at will (with tab & shift-tab or up & down arrow keys). On new line, returns the values of the blanks (treating
|
47
47
|
placeholders as a default values if no editing occured)
|
48
48
|
email:
|
49
49
|
- fawkes@mit.edu
|