search_ui 0.0.0 → 0.0.1

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
  SHA256:
3
- metadata.gz: 37d829ad8fbcc4b4e0ae9e986f10b156edea28650062f1e53d79c767fe07dbc1
4
- data.tar.gz: 851f87e4e5731d1b515a6354cc13a95820007d179acdee7621009b318378a501
3
+ metadata.gz: 35af8d1543a7a7aceef95fd7212c4f0ea26ba16b26a0dff099796fdd0f6811d9
4
+ data.tar.gz: 3174844d7b3dda6798e110e72a7390d8542f3403d8f663782d55163a3518e38b
5
5
  SHA512:
6
- metadata.gz: 1beb2eb6a53971c40ab62c898ef5c78fe9c59a39e5b8fa4bd61dedf2c9271b94ad8379fdbbb54a2f50a359e979e9cccc43e0585ebdb8a2103a782685e3fcc0a8
7
- data.tar.gz: 0270c1ec8d11b71335ea880c3fc82c4b919f21b97d0e76267cb3f8766a459f130c57a73344e1697644555761145957b78e6e23b83b23a8977e8f7e87031953be
6
+ metadata.gz: 8c409e8a930dea22dc154a324743a2db09f48954802ff80c9c97243f71b4b9cc5206e79eef9b8277d4048e1535bcb5c8d393f6576afce7610bcd9bc2415dfff0
7
+ data.tar.gz: be4d585229c53f712bc995f17152be4b96e6f16a66c77ecc08a2c36994400e8effa268d59a8ced1f6b9882d488ada09c7c7c0a71803d6e6aba9a187e5c2b6e68
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -12,7 +12,7 @@ exit if choices.empty?
12
12
  found = Search.new(
13
13
  match: -> answer {
14
14
  matcher = Amatch::PairDistance.new(answer.downcase)
15
- matches = ARGV.map { |n| [ n, -matcher.similar(n.downcase) ] }.
15
+ matches = choices.map { |n| [ n, -matcher.similar(n.downcase) ] }.
16
16
  select { |_, s| s < 0 }.sort_by(&:last).map(&:first)
17
17
  matches.empty? and matches = choices
18
18
  matches.first(Tins::Terminal.lines - 1)
@@ -26,10 +26,9 @@ class SearchUI::Search
26
26
  @matches = @match.(@answer)
27
27
  @selector = [ 0, [ @selector, @matches.size - 1 ].min ].max
28
28
  result = @query.(@answer, @matches, @selector)
29
- @output.print clear_screen
30
- @output.print move_home { ?\n + result }
31
29
  loop do
32
- @output.print move_home { @prompt % @answer }
30
+ @output.print clear_screen
31
+ @output.print move_home { @prompt % @answer + ?\n + result }
33
32
  case getc
34
33
  when true
35
34
  @output.print clear_screen, move_home, reset
@@ -44,8 +43,6 @@ class SearchUI::Search
44
43
  @matches = @match.(@answer)
45
44
  @selector = [ 0, [ @selector, @matches.size - 1 ].min ].max
46
45
  result = @query.(@answer, @matches, @selector)
47
- @output.print clear_screen
48
- @output.print move_home { ?\n + result }
49
46
  end
50
47
  end
51
48
 
@@ -1,6 +1,6 @@
1
1
  module SearchUi
2
2
  # SearchUi version
3
- VERSION = '0.0.0'
3
+ VERSION = '0.0.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: search_ui 0.0.0 ruby lib
2
+ # stub: search_ui 0.0.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "search_ui".freeze
6
- s.version = "0.0.0"
6
+ s.version = "0.0.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2020-02-11"
11
+ s.date = "2020-02-14"
12
12
  s.description = "This library allows a user to search an array of objects\n interactively in the console by matching the pattern a user inputs to an\n array of objects and pick one of the remaining objects.".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["search_it".freeze]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-11 00:00:00.000000000 Z
11
+ date: 2020-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar