tty-prompt 0.17.2 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +2 -2
  4. data/examples/ask.rb +1 -1
  5. data/examples/ask_valid.rb +1 -1
  6. data/examples/collect.rb +1 -1
  7. data/examples/echo.rb +1 -1
  8. data/examples/enum_select.rb +1 -1
  9. data/examples/enum_select_disabled.rb +1 -1
  10. data/examples/enum_select_paged.rb +1 -1
  11. data/examples/enum_select_wrapped.rb +1 -1
  12. data/examples/expand.rb +1 -1
  13. data/examples/in.rb +1 -1
  14. data/examples/inputs.rb +1 -1
  15. data/examples/key_events.rb +5 -1
  16. data/examples/keypress.rb +1 -1
  17. data/examples/mask.rb +1 -1
  18. data/examples/multi_select.rb +1 -1
  19. data/examples/multi_select_disabled.rb +1 -1
  20. data/examples/multi_select_paged.rb +1 -1
  21. data/examples/multi_select_wrapped.rb +1 -1
  22. data/examples/multiline.rb +1 -1
  23. data/examples/pause.rb +1 -1
  24. data/examples/select.rb +1 -1
  25. data/examples/select_disabled.rb +1 -1
  26. data/examples/select_enum.rb +1 -1
  27. data/examples/select_filtered.rb +1 -1
  28. data/examples/select_paginated.rb +1 -1
  29. data/examples/select_wrapped.rb +1 -1
  30. data/examples/slider.rb +2 -2
  31. data/examples/validation.rb +1 -1
  32. data/examples/yes_no.rb +1 -1
  33. data/lib/tty-prompt.rb +0 -2
  34. data/lib/tty/prompt.rb +0 -1
  35. data/lib/tty/prompt/answers_collector.rb +0 -1
  36. data/lib/tty/prompt/choice.rb +0 -1
  37. data/lib/tty/prompt/choices.rb +0 -1
  38. data/lib/tty/prompt/confirm_question.rb +0 -1
  39. data/lib/tty/prompt/converter_dsl.rb +0 -1
  40. data/lib/tty/prompt/converter_registry.rb +0 -1
  41. data/lib/tty/prompt/converters.rb +0 -1
  42. data/lib/tty/prompt/distance.rb +0 -1
  43. data/lib/tty/prompt/enum_list.rb +0 -1
  44. data/lib/tty/prompt/enum_paginator.rb +0 -1
  45. data/lib/tty/prompt/evaluator.rb +0 -1
  46. data/lib/tty/prompt/expander.rb +0 -1
  47. data/lib/tty/prompt/keypress.rb +1 -2
  48. data/lib/tty/prompt/list.rb +0 -1
  49. data/lib/tty/prompt/mask_question.rb +0 -1
  50. data/lib/tty/prompt/multi_list.rb +0 -1
  51. data/lib/tty/prompt/multiline.rb +0 -1
  52. data/lib/tty/prompt/paginator.rb +0 -1
  53. data/lib/tty/prompt/question.rb +0 -1
  54. data/lib/tty/prompt/question/checks.rb +0 -1
  55. data/lib/tty/prompt/question/modifier.rb +0 -1
  56. data/lib/tty/prompt/question/validation.rb +0 -1
  57. data/lib/tty/prompt/result.rb +0 -1
  58. data/lib/tty/prompt/slider.rb +0 -1
  59. data/lib/tty/prompt/statement.rb +0 -1
  60. data/lib/tty/prompt/suggestion.rb +0 -1
  61. data/lib/tty/prompt/symbols.rb +0 -1
  62. data/lib/tty/prompt/timeout.rb +0 -1
  63. data/lib/tty/prompt/utils.rb +0 -1
  64. data/lib/tty/prompt/version.rb +1 -1
  65. data/lib/tty/test_prompt.rb +0 -1
  66. data/spec/spec_helper.rb +2 -2
  67. data/spec/unit/ask_spec.rb +1 -1
  68. data/spec/unit/choice/eql_spec.rb +1 -1
  69. data/spec/unit/choice/from_spec.rb +1 -1
  70. data/spec/unit/choices/add_spec.rb +1 -1
  71. data/spec/unit/choices/each_spec.rb +1 -1
  72. data/spec/unit/choices/find_by_spec.rb +1 -1
  73. data/spec/unit/choices/new_spec.rb +1 -1
  74. data/spec/unit/choices/pluck_spec.rb +1 -1
  75. data/spec/unit/collect_spec.rb +1 -1
  76. data/spec/unit/converters/convert_bool_spec.rb +1 -1
  77. data/spec/unit/converters/convert_char_spec.rb +1 -1
  78. data/spec/unit/converters/convert_custom_spec.rb +1 -1
  79. data/spec/unit/converters/convert_date_spec.rb +1 -1
  80. data/spec/unit/converters/convert_file_spec.rb +1 -1
  81. data/spec/unit/converters/convert_number_spec.rb +1 -1
  82. data/spec/unit/converters/convert_path_spec.rb +1 -1
  83. data/spec/unit/converters/convert_range_spec.rb +1 -1
  84. data/spec/unit/converters/convert_regex_spec.rb +1 -1
  85. data/spec/unit/converters/convert_string_spec.rb +1 -1
  86. data/spec/unit/converters/on_error_spec.rb +1 -1
  87. data/spec/unit/distance/distance_spec.rb +1 -1
  88. data/spec/unit/enum_paginator_spec.rb +1 -1
  89. data/spec/unit/enum_select_spec.rb +4 -4
  90. data/spec/unit/error_spec.rb +1 -1
  91. data/spec/unit/evaluator_spec.rb +1 -1
  92. data/spec/unit/expand_spec.rb +1 -1
  93. data/spec/unit/keypress_spec.rb +1 -1
  94. data/spec/unit/mask_spec.rb +1 -1
  95. data/spec/unit/multi_select_spec.rb +3 -3
  96. data/spec/unit/multiline_spec.rb +1 -1
  97. data/spec/unit/new_spec.rb +1 -1
  98. data/spec/unit/ok_spec.rb +1 -1
  99. data/spec/unit/paginator_spec.rb +1 -1
  100. data/spec/unit/question/checks_spec.rb +1 -1
  101. data/spec/unit/question/default_spec.rb +1 -1
  102. data/spec/unit/question/echo_spec.rb +1 -1
  103. data/spec/unit/question/in_spec.rb +1 -1
  104. data/spec/unit/question/initialize_spec.rb +1 -1
  105. data/spec/unit/question/modifier/apply_to_spec.rb +1 -1
  106. data/spec/unit/question/modifier/letter_case_spec.rb +1 -1
  107. data/spec/unit/question/modifier/whitespace_spec.rb +1 -1
  108. data/spec/unit/question/modify_spec.rb +1 -1
  109. data/spec/unit/question/required_spec.rb +1 -1
  110. data/spec/unit/question/validate_spec.rb +1 -1
  111. data/spec/unit/question/validation/call_spec.rb +1 -1
  112. data/spec/unit/question/validation/coerce_spec.rb +1 -1
  113. data/spec/unit/result_spec.rb +1 -1
  114. data/spec/unit/say_spec.rb +1 -1
  115. data/spec/unit/select_spec.rb +3 -3
  116. data/spec/unit/slider_spec.rb +1 -1
  117. data/spec/unit/statement/initialize_spec.rb +1 -1
  118. data/spec/unit/subscribe_spec.rb +2 -0
  119. data/spec/unit/suggest_spec.rb +1 -1
  120. data/spec/unit/warn_spec.rb +1 -1
  121. data/spec/unit/yes_no_spec.rb +1 -1
  122. data/tty-prompt.gemspec +1 -2
  123. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5132a0018789c045981bf472bb2dfcf088701d50eb61ddec5e8945b3802786b4
4
- data.tar.gz: a737e6b706f326ab39f58541adb05a2f85481374dfbb10b3f4e546f1f6c88e54
3
+ metadata.gz: d6b5dc469236b43c2439a9d62d9356d540c3aa0c3e359916b97fabc2ffe53a1f
4
+ data.tar.gz: '0229e21607f28ce8407e109d58b26b4d2d782a4f883e5a5580f5db022caa8e0d'
5
5
  SHA512:
6
- metadata.gz: 0b23beb0dc70f5beda1b686c1650c7d078df0e8d9b040eaa8751c5da14f058e30f74d2f4b671d5ef8ce640f2cb30bc555a27ad58d75e28a0ffb0a8de2fd6a7c9
7
- data.tar.gz: ebfd4d6309d87070e32932031f5250f60e39fd444ffbe3735e2445433825858c08c07894d660726dd83c31e572c030a93abbd515f4d634a3ba6fed363bfe0d54
6
+ metadata.gz: a0965a8ec33d8b6a00860e7f15fb6ebb731de62213b4322f732dc8a6c5b41c2da3030082fd3bca1a29e46f141d4233b9db4cbc7ddf9cd5b67632b184d34ca69f
7
+ data.tar.gz: 8c663d1388d1ec3adfa348e344d74bde55b5d2b61c33db30c877ea363a9e4a78f9723c9e36721912a6987395f93b1d25d4f5222abf0999795bb23bd5b97911f1
@@ -1,5 +1,16 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.18.0] - 2018-11-24
4
+
5
+ ### Changed
6
+ * Change to update tty-reader dependency
7
+ * Remove encoding magic comments
8
+
9
+ ### Fixed
10
+ * Fix #keypress to stop using the :nonblock option
11
+ * Fix input reading to correctly capture the Esc key(#84)
12
+ * Fix line editing when cursor is on second to last character(#94)
13
+
3
14
  ## [v0.17.2] - 2018-11-01
4
15
 
5
16
  ### Fixed
@@ -285,6 +296,7 @@
285
296
 
286
297
  * Initial implementation and release
287
298
 
299
+ [v0.18.0]: https://github.com/piotrmurach/tty-prompt/compare/v0.17.2...v0.18.0
288
300
  [v0.17.2]: https://github.com/piotrmurach/tty-prompt/compare/v0.17.1...v0.17.2
289
301
  [v0.17.1]: https://github.com/piotrmurach/tty-prompt/compare/v0.17.0...v0.17.1
290
302
  [v0.17.0]: https://github.com/piotrmurach/tty-prompt/compare/v0.16.1...v0.17.0
data/README.md CHANGED
@@ -644,7 +644,7 @@ end
644
644
  # ‣ Jax
645
645
  ```
646
646
 
647
- You can navigate the choices using the arrow keys or define your own keymappings (see [keyboard events](#212-keyboard-events). When reaching the top/bottom of the list, the selection does not cycle around by default. If you wish to enable cycling, you can pass `cycle: true` to `select` and `mutli_select`:
647
+ You can navigate the choices using the arrow keys or define your own key mappings (see [keyboard events](#212-keyboard-events). When reaching the top/bottom of the list, the selection does not cycle around by default. If you wish to enable cycling, you can pass `cycle: true` to `select` and `mutli_select`:
648
648
 
649
649
  ```ruby
650
650
  prompt.select("Choose your destiny?", %w(Scorpion Kano Jax), cycle: true)
@@ -1405,4 +1405,4 @@ This project is intended to be a safe, welcoming space for collaboration, and co
1405
1405
 
1406
1406
  ## Copyright
1407
1407
 
1408
- Copyright (c) 2015-2018 Piotr Murach. See LICENSE for further details.
1408
+ Copyright (c) 2015 Piotr Murach. See LICENSE for further details.
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative '../lib/tty-prompt'
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -8,4 +8,8 @@ prompt.on(:keypress) do |event|
8
8
  puts "name: #{event.key.name}, value: #{event.value.dump}"
9
9
  end
10
10
 
11
+ prompt.on(:keyescape) do |event|
12
+ exit
13
+ end
14
+
11
15
  prompt.read_keypress
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
  require 'pastel'
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative '../lib/tty-prompt'
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_litreal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative '../lib/tty-prompt'
4
4
 
@@ -1,6 +1,6 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
5
5
  prompt = TTY::Prompt.new
6
- prompt.slider("Volume", max: 100, step: 5, default: 75, format: "|:slider| %d%")
6
+ prompt.slider("Volume", max: 100, step: 5, default: 75, format: "|:slider| %d%%")
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/tty-prompt"
4
4
 
@@ -1,4 +1,2 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative 'tty/prompt'
4
2
  require_relative 'tty/test_prompt'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'forwardable'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'forwardable'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'question'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'converter_registry'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'pathname'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'English'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'paginator'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'result'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'choices'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'question'
@@ -75,7 +74,7 @@ module TTY
75
74
  time do
76
75
  @prompt.print(render_question)
77
76
  until @done
78
- @input = @prompt.read_keypress(nonblock: true)
77
+ @input = @prompt.read_keypress
79
78
  end
80
79
  end
81
80
  @evaluator.(@input)
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'English'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'question'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'list'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'question'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'converters'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'symbols'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'distance'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'timers'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  class Prompt
5
- VERSION = '0.17.2'
5
+ VERSION = '0.18.0'
6
6
  end # Prompt
7
7
  end # TTY
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require_relative 'prompt'
@@ -1,6 +1,6 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])
3
+ if ENV['COVERAGE'] || ENV['TRAVIS']
4
4
  require 'simplecov'
5
5
  require 'coveralls'
6
6
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#ask' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Choice, '#==' do
4
4
  it "is true with the same name and value attributes" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Choice, '#from' do
4
4
  it "skips Choice instance" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Choices, '#<<' do
4
4
  it "adds choice to collection" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Choices, '.each' do
4
4
  it "iterates over collection" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Choices, '#find_by' do
4
4
  it "finds a matching choice by key name" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Choices, '.new' do
4
4
  it "creates choices collection" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Choices, '#pluck' do
4
4
  it "plucks choice by key name" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#collect' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert bool' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert char' do
4
4
  it 'reads single character' do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert custom' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert date' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert file' do
4
4
  it "converts to file" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert numbers' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert path' do
4
4
  subject(:prompt) { TTY::TestPrompt.new }
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert range' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert regexp' do
4
4
  it "converts regex" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, 'convert string' do
4
4
  it 'converts string' do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Converters do
4
4
  it "enforces block argument" do
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Distance, '.distance' do
4
4
  let(:object) { described_class.new }
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::EnumPaginator, '#paginate' do
4
4
  it "ignores per_page when equal items " do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt do
4
4
  let(:symbols) { TTY::Prompt::Symbols.symbols }
@@ -9,7 +9,7 @@ RSpec.describe TTY::Prompt do
9
9
  error = options[:error]
10
10
  default = options.fetch(:default, 1)
11
11
 
12
- out = ""
12
+ out = []
13
13
  out << prompt << " \n"
14
14
  out << choices.map.with_index do |c, i|
15
15
  name = c.is_a?(Hash) ? c[:name] : c
@@ -25,7 +25,7 @@ RSpec.describe TTY::Prompt do
25
25
  end.join("\n")
26
26
  out << "\n"
27
27
  choice = " Choose 1-#{choices.count} [#{default}]: "
28
- choice << input.to_s if input
28
+ choice = choice + input.to_s if input
29
29
  out << choice
30
30
  if error
31
31
  out << "\n"
@@ -34,7 +34,7 @@ RSpec.describe TTY::Prompt do
34
34
  end
35
35
  out << "\e[2K\e[1G\e[1A" * (choices.count + 1)
36
36
  out << "\e[2K\e[1G\e[J"
37
- out
37
+ out.join
38
38
  end
39
39
 
40
40
  def exit_message(prompt, choice)
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '.error' do
4
4
  subject(:prompt) { TTY::TestPrompt.new }
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Evaluator do
4
4
  it "checks chained validation procs" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#expand' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, '#keypress' do
4
4
  it 'receives line feed with echo on' do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#mask' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt do
4
4
  let(:symbols) { TTY::Prompt::Symbols.symbols }
@@ -9,7 +9,7 @@ RSpec.describe TTY::Prompt do
9
9
  init = options.fetch(:init, false)
10
10
  enum = options[:enum]
11
11
 
12
- out = ""
12
+ out = []
13
13
  out << "\e[?25l" if init
14
14
  out << prompt << " "
15
15
  out << selected.join(', ')
@@ -33,7 +33,7 @@ RSpec.describe TTY::Prompt do
33
33
  end.join("\n")
34
34
  out << "\e[2K\e[1G\e[1A" * choices.count
35
35
  out << "\e[2K\e[1G"
36
- out
36
+ out.join
37
37
  end
38
38
 
39
39
  def exit_message(prompt, choices)
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, '#multiline' do
4
4
  it 'reads no lines' do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#new' do
4
4
  let(:env) { { "TTY_TEST" => true } }
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, 'ok' do
4
4
  subject(:prompt) { TTY::TestPrompt.new }
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Paginator, '#paginate' do
4
4
  it "ignores per_page when equal items " do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, '#default' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, '#echo' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, '#in' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, '#initialize' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question::Modifier, '#apply_to' do
4
4
  let(:string) { "text to be modified"}
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question::Modifier, '#letter_case' do
4
4
  context "string" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question::Modifier, '#whitespace' do
4
4
  context "string with whitespaces" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, '#modify' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, '#required' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question, '#validate' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question::Validation, '#call' do
4
4
  let(:pattern) { /^[^\.]+\.[^\.]+/ }
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Question::Validation, '#coerce' do
4
4
  let(:instance) { described_class.new }
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Result do
4
4
  it "checks value to be invalid" do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#say' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#select' do
4
4
 
@@ -12,7 +12,7 @@ RSpec.describe TTY::Prompt, '#select' do
12
12
  init = options.fetch(:init, false)
13
13
  enum = options[:enum]
14
14
 
15
- out = ""
15
+ out = []
16
16
  out << "\e[?25l" if init
17
17
  out << prompt << " "
18
18
  out << "\e[90m(#{hint})\e[0m" if hint
@@ -32,7 +32,7 @@ RSpec.describe TTY::Prompt, '#select' do
32
32
  out << "\e[2K\e[1G\e[1A" * choices.count
33
33
  out << "\e[2K\e[1G"
34
34
  out << "\e[1A\e[2K\e[1G" if choices.empty?
35
- out
35
+ out.join
36
36
  end
37
37
 
38
38
  def exit_message(prompt, choice)
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#slider' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt::Statement, '#new' do
4
4
  it "forces newline after the prompt message" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe TTY::Prompt, '#subscribe' do
2
4
  it "subscribes to key events only for the current prompt" do
3
5
  prompt = TTY::TestPrompt.new
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#suggest' do
4
4
  let(:possible) { %w(status stage stash commit branch blame) }
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, '#warn' do
4
4
 
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe TTY::Prompt, 'confirmation' do
4
4
 
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'tty/prompt/version'
@@ -26,7 +25,7 @@ Gem::Specification.new do |spec|
26
25
  spec.add_dependency 'pastel', '~> 0.7.0'
27
26
  spec.add_dependency 'timers', '~> 4.0'
28
27
  spec.add_dependency 'tty-cursor', '~> 0.6.0'
29
- spec.add_dependency 'tty-reader', '~> 0.4.0'
28
+ spec.add_dependency 'tty-reader', '~> 0.5.0'
30
29
 
31
30
  spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
32
31
  spec.add_development_dependency 'rake'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty-prompt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.2
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-01 00:00:00.000000000 Z
11
+ date: 2018-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: necromancer
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.4.0
75
+ version: 0.5.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.4.0
82
+ version: 0.5.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement