inquirex-tty 0.9.4 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/badges/coverage_badge.svg +2 -2
- data/examples/makeabox.rb +93 -0
- data/lib/inquirex/tty/renderer.rb +41 -2
- data/lib/inquirex/tty/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c91d8b125db72e34420575e33b12dd5fed05353e9df289ea4665f53e5d64a7b
|
|
4
|
+
data.tar.gz: c2b8f0bc334e8c47809cd38e4697fa165a75118032ee41aefc2ddb27f7e9f042
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0288a89785bbcb89b4437c48f4f96695fcbace9713ceb6eca2181d8cd2d9131b6c97ee26766300f9a95ac83dc72596d4e82e8287842b32d10a40f3ef6160e9b4'
|
|
7
|
+
data.tar.gz: a42da62f0f194c99bed2ad417ad35a2e16dfe6d50b9d91fc9262c5d2854229819c1da687858ab757cfd7e929fa4a4efd2f48253da751739a771fbc95d221965f
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
|
16
16
|
<text x="31.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
|
17
17
|
<text x="31.5" y="14">coverage</text>
|
|
18
|
-
<text x="80" y="15" fill="#010101" fill-opacity=".3">
|
|
19
|
-
<text x="80" y="14">
|
|
18
|
+
<text x="80" y="15" fill="#010101" fill-opacity=".3">96%</text>
|
|
19
|
+
<text x="80" y="14">96%</text>
|
|
20
20
|
</g>
|
|
21
21
|
</svg>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Inquirex.define do
|
|
2
|
+
start :do_you_have_a_minute
|
|
3
|
+
|
|
4
|
+
confirm :do_you_have_a_minute do
|
|
5
|
+
type :boolean
|
|
6
|
+
question "Do you you have a few minutes to help us understand how you use the site, what's working and what needs fixing?"
|
|
7
|
+
widget type: :toggle
|
|
8
|
+
widget target: :mobile, type: :yes_no_buttons
|
|
9
|
+
transition to: :name, if_rule: equals(:do_you_have_a_minute, true)
|
|
10
|
+
transition to: :no_problem
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
ask :name do
|
|
14
|
+
type :string
|
|
15
|
+
question "What is your name? However you'd like to be called."
|
|
16
|
+
widget type: :text_input
|
|
17
|
+
widget target: :mobile, type: :text_input
|
|
18
|
+
transition to: :email
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
ask :email do
|
|
22
|
+
type :email
|
|
23
|
+
question "Please share with us your email address so that we can notify you when your ideas and feedback has been put to good use."
|
|
24
|
+
widget type: :email_input
|
|
25
|
+
widget target: :mobile, type: :email_input
|
|
26
|
+
transition to: :other_tools
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
say :no_problem do
|
|
30
|
+
text "Not a problem. If you ever change your mind, just hit that round circle and answer the quesitons,. Adios!"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
ask :other_tools do
|
|
34
|
+
type :boolean
|
|
35
|
+
question "Do you use any other online tools for generating laser cuts or engraving?"
|
|
36
|
+
default false
|
|
37
|
+
transition to: :uses_other_tools, if_rule: equals(:other_tools, true)
|
|
38
|
+
transition to: :how_long_you_used_makeabox
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
ask :uses_other_tools do
|
|
42
|
+
type :multi_enum
|
|
43
|
+
question "May we ask which tools do you use to building enclosures cut with a laser cutter? If the tool you use is not listed, choose Unlisted."
|
|
44
|
+
options i_dont: "I don't use Any of Them",
|
|
45
|
+
makeabox: "MakeABox.io (this site)",
|
|
46
|
+
makercase: "Makercase",
|
|
47
|
+
boxes_py: "Boxes.py",
|
|
48
|
+
www_atomm_com: "Atomm.com",
|
|
49
|
+
vector_painter: "Vector Painter.com",
|
|
50
|
+
laserbiz_ru: "Laserbiz.ru",
|
|
51
|
+
hessmer_org_gears: "hessmer.org/gears",
|
|
52
|
+
unlisted: "Unlisted (Other)"
|
|
53
|
+
transition to: :makeabox_only, if_rule: contains(:uses_other_tools, "makeabox")
|
|
54
|
+
transition to: :other, if_rule: contains(:uses_other_tools, "unlisted")
|
|
55
|
+
transition to: :feedback
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
say :makeabox_only do
|
|
59
|
+
text "Thanks for using MakeABox only :) We hope to improve this application futher and we appreciate your choice, considering there are a few out there :)"
|
|
60
|
+
transition to: :how_long_you_used_makeabox
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
ask :how_long_you_used_makeabox do
|
|
64
|
+
type :enum
|
|
65
|
+
question "Give us a sense about how long have you been used MakeABox.io..."
|
|
66
|
+
options first_time: "My First TIme",
|
|
67
|
+
about_a_month: "About a Month",
|
|
68
|
+
a_few_months: "A few Months",
|
|
69
|
+
at_least_a_year: "At least a Year",
|
|
70
|
+
over_a_year: "Over a Year",
|
|
71
|
+
over_two_years: "Over two Years"
|
|
72
|
+
default :first_time
|
|
73
|
+
transition to: :other, if_rule: contains(:uses_other_tools, "unlisted")
|
|
74
|
+
transition to: :feedback
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
ask :other do
|
|
78
|
+
type :text
|
|
79
|
+
widget type: :text_input
|
|
80
|
+
question "Can you list the tools not listed in the previous question?"
|
|
81
|
+
transition to: :feedback
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
ask :feedback do
|
|
85
|
+
question "Pelase provide any feedback or bug reports that will make MakeABox.io better."
|
|
86
|
+
type :text
|
|
87
|
+
transition to: :thanks
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
say :thanks do
|
|
91
|
+
text "We appreciate you taking the time to answer some of the questions! See you around!"
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -190,12 +190,51 @@ module Inquirex
|
|
|
190
190
|
# Integer or float depending on the node's data type.
|
|
191
191
|
def render_number_input(node)
|
|
192
192
|
convert = node.type == :integer ? :int : :float
|
|
193
|
-
|
|
193
|
+
ask_bounded(node, convert:)
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
# Float for currency types.
|
|
197
197
|
def render_currency_input(node)
|
|
198
|
-
|
|
198
|
+
ask_bounded(node, convert: :float)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Asks for a number, enforcing the node's declared bounds.
|
|
202
|
+
#
|
|
203
|
+
# tty-prompt's `in:` re-asks until the answer falls inside the range,
|
|
204
|
+
# which is the terminal's equivalent of the widget's stepper bounds — the
|
|
205
|
+
# user is corrected before the value is ever stored, rather than having it
|
|
206
|
+
# silently clamped afterwards. An unbounded node keeps the plain ask so
|
|
207
|
+
# the prompt text is unchanged for the overwhelmingly common case.
|
|
208
|
+
#
|
|
209
|
+
# @param node [Inquirex::Node] the step being rendered
|
|
210
|
+
# @param convert [Symbol] :int or :float
|
|
211
|
+
# @return [Numeric, nil]
|
|
212
|
+
def ask_bounded(node, convert:)
|
|
213
|
+
return prompt.ask(node.question, convert:) unless node.bounded?
|
|
214
|
+
|
|
215
|
+
prompt.ask(node.question, convert:, in: bounds_range(node)) do |q|
|
|
216
|
+
q.messages[:range?] = "Enter a value #{describe_bounds(node)}."
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# The node's bounds as a Range tty-prompt understands. An open end is
|
|
221
|
+
# spelled with infinity rather than omitted, since `in:` wants a Range.
|
|
222
|
+
#
|
|
223
|
+
# @param node [Inquirex::Node]
|
|
224
|
+
# @return [Range]
|
|
225
|
+
def bounds_range(node)
|
|
226
|
+
low = node.min || -Float::INFINITY
|
|
227
|
+
high = node.max || Float::INFINITY
|
|
228
|
+
low..high
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# @param node [Inquirex::Node]
|
|
232
|
+
# @return [String] human phrasing of whichever bounds exist
|
|
233
|
+
def describe_bounds(node)
|
|
234
|
+
return "between #{node.min} and #{node.max}" if node.min && node.max
|
|
235
|
+
return "of #{node.min} or more" if node.min
|
|
236
|
+
|
|
237
|
+
"of #{node.max} or less"
|
|
199
238
|
end
|
|
200
239
|
|
|
201
240
|
# Boolean — tty-prompt yes?.
|
data/lib/inquirex/tty/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inquirex-tty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Konstantin Gredeskoul
|
|
@@ -29,28 +29,28 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 0.9.5
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
39
|
+
version: 0.9.5
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: inquirex-llm
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
46
|
+
version: 0.9.5
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
53
|
+
version: 0.9.5
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: ostruct
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -170,6 +170,7 @@ files:
|
|
|
170
170
|
- examples/11_llm_keywords.rb
|
|
171
171
|
- examples/README.md
|
|
172
172
|
- examples/burning-man.rb
|
|
173
|
+
- examples/makeabox.rb
|
|
173
174
|
- exe/inqt
|
|
174
175
|
- exe/inquirex-tty
|
|
175
176
|
- justfile
|