utils 0.17.0 → 0.18.0

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: 37ab9d9db752bd2e79a46c3ae402d09a8f6b1a1e0ad9bf1f1cfb969c58a92c55
4
- data.tar.gz: 55c4fcae89c4f36f9ef1376e64a3483f70943f560d444997ecf1eceaf48517b4
3
+ metadata.gz: 5d34a30035558c666c0079685fe27e636b8cd261291865f822bd7180473e9a6e
4
+ data.tar.gz: d7022c87ebe943e973fcf5e77e7a491111b66a836773c05ba09e91cf2d9b567b
5
5
  SHA512:
6
- metadata.gz: 0c33062881cf649b6b966c306ea710c5e404f279f7cded83b0557b2bc6a846bc14ad81b9a37b67ec33cc37f397797686beff2a1dacb9d470f2a6aec275559218
7
- data.tar.gz: 8befe84924b2e00f6b8dc7e7f9add2fb7c6765639369603a6eabbd205470d0863e3241b9495532c18630ab0459508dd57c24340d09d073d83899cd220864a971
6
+ metadata.gz: 2aa7813acb3887eaf9ee143bce270e8bc5470ecd2a37d6bf18107110674b94f4b99146e0440f208524ddf9a9cd82ac1a86365fdc1429615fbc9952976a4ce92a
7
+ data.tar.gz: 987b1c4a98057c7b317cc5ce2d0b0762cbe4e5335f5ac1756d07a1b431bb6730235973e9236241be733a96f034fe138d3dde73e413c57338ed1d989993957dac
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17.0
1
+ 0.18.0
@@ -10,7 +10,7 @@ module Utils
10
10
  require 'utils/probe_server'
11
11
  require 'utils/ssh_tunnel_specification'
12
12
  require 'utils/line_blamer'
13
- require 'utils/interactive_search'
13
+ require 'utils/search_ui'
14
14
  begin
15
15
  require 'utils/line_formatter'
16
16
  rescue LoadError
@@ -1,5 +1,6 @@
1
1
  require 'term/ansicolor'
2
- class Utils::InteractiveSearch
2
+
3
+ class Utils::SearchUI
3
4
  include Term::ANSIColor
4
5
 
5
6
  def initialize(query:, found:, output: STDOUT, prompt: 'Search? %s')
@@ -11,20 +12,24 @@ class Utils::InteractiveSearch
11
12
  end
12
13
 
13
14
  def start
14
- @output.print clear_screen
15
+ @output.print clear_screen, move_home, reset
15
16
  loop do
16
- @output.print move_home(@prompt % @answer)
17
+ @output.print move_home { @prompt % @answer }
17
18
  case getc
18
19
  when true
19
- @output.print clear_screen move_home reset
20
- return !!@found.(@answer)
20
+ @output.print clear_screen, move_home, reset
21
+ if result = @found.(@answer)
22
+ return result
23
+ else
24
+ return nil
25
+ end
21
26
  when false
22
- return false
27
+ return nil
23
28
  end
24
29
  result = @query.(@answer)
25
30
  @output.print clear_screen
26
31
  unless @answer.empty?
27
- @output.print clear_screen move_to_line(2, result)
32
+ @output.print move_home { ?\n + result }
28
33
  end
29
34
  end
30
35
  end
@@ -45,6 +50,7 @@ class Utils::InteractiveSearch
45
50
  nil
46
51
  when "\v"
47
52
  @answer.clear
53
+ nil
48
54
  when /\A[\x00-\x1f]\z/
49
55
  nil
50
56
  else
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.17.0'
3
+ VERSION = '0.18.0'
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,22 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.17.0 ruby lib
2
+ # stub: utils 0.18.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils".freeze
6
- s.version = "0.17.0"
6
+ s.version = "0.18.0"
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 = "2019-11-20"
11
+ s.date = "2019-12-02"
12
12
  s.description = "This ruby gem provides some useful command line utilities".freeze
13
13
  s.email = "flori@ping.de".freeze
14
- s.executables = ["discover".freeze, "classify".freeze, "sedit".freeze, "bootdisk".freeze, "irb_connect".freeze, "ascii7".freeze, "path".freeze, "enum".freeze, "unquarantine_apps".freeze, "ssh-tunnel".freeze, "xmp".freeze, "brakeman2err".freeze, "search".freeze, "chroot-exec".freeze, "edit".freeze, "tmproc".freeze, "json_check".freeze, "edit_wait".freeze, "errf".freeze, "untest".freeze, "blameline".freeze, "remote_copy".freeze, "git-empty".freeze, "create_cstags".freeze, "vacuum_firefox_sqlite".freeze, "same_files".freeze, "chroot-libs".freeze, "git-versions".freeze, "strip_spaces".freeze, "number_files".freeze, "rssr".freeze, "serve".freeze, "vcf2alias".freeze, "on_change".freeze, "utils-utilsrc".freeze, "myex".freeze, "long_lines".freeze, "dialog-pick".freeze, "probe".freeze, "create_tags".freeze]
15
- s.extra_rdoc_files = ["README.md".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/interactive_search.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze]
16
- s.files = [".gitignore".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/bootdisk".freeze, "bin/brakeman2err".freeze, "bin/chroot-exec".freeze, "bin/chroot-libs".freeze, "bin/classify".freeze, "bin/create_cstags".freeze, "bin/create_tags".freeze, "bin/dialog-pick".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/errf".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_connect".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/number_files".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/probe".freeze, "bin/remote_copy".freeze, "bin/rssr".freeze, "bin/same_files".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/tmproc".freeze, "bin/unquarantine_apps".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vacuum_firefox_sqlite".freeze, "bin/vcf2alias".freeze, "bin/xmp".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/interactive_search.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "utils.gemspec".freeze]
14
+ s.executables = ["discover".freeze, "classify".freeze, "sedit".freeze, "irb_connect".freeze, "ascii7".freeze, "path".freeze, "enum".freeze, "unquarantine_apps".freeze, "ssh-tunnel".freeze, "xmp".freeze, "brakeman2err".freeze, "search".freeze, "chroot-exec".freeze, "edit".freeze, "tmproc".freeze, "json_check".freeze, "edit_wait".freeze, "errf".freeze, "untest".freeze, "blameline".freeze, "remote_copy".freeze, "git-empty".freeze, "create_cstags".freeze, "vacuum_firefox_sqlite".freeze, "same_files".freeze, "chroot-libs".freeze, "git-versions".freeze, "strip_spaces".freeze, "number_files".freeze, "rssr".freeze, "serve".freeze, "vcf2alias".freeze, "on_change".freeze, "utils-utilsrc".freeze, "myex".freeze, "long_lines".freeze, "dialog-pick".freeze, "probe".freeze, "create_tags".freeze]
15
+ s.extra_rdoc_files = ["README.md".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/search_ui.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze]
16
+ s.files = [".gitignore".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/brakeman2err".freeze, "bin/chroot-exec".freeze, "bin/chroot-libs".freeze, "bin/classify".freeze, "bin/create_cstags".freeze, "bin/create_tags".freeze, "bin/dialog-pick".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/errf".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_connect".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/number_files".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/probe".freeze, "bin/remote_copy".freeze, "bin/rssr".freeze, "bin/same_files".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/tmproc".freeze, "bin/unquarantine_apps".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vacuum_firefox_sqlite".freeze, "bin/vcf2alias".freeze, "bin/xmp".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/search_ui.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "utils.gemspec".freeze]
17
17
  s.homepage = "http://github.com/flori/utils".freeze
18
18
  s.rdoc_options = ["--title".freeze, "Utils - Some useful command line utilities".freeze, "--main".freeze, "README.md".freeze]
19
- s.rubygems_version = "3.0.6".freeze
19
+ s.rubygems_version = "3.0.3".freeze
20
20
  s.summary = "Some useful command line utilities".freeze
21
21
 
22
22
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-20 00:00:00.000000000 Z
11
+ date: 2019-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -114,7 +114,6 @@ executables:
114
114
  - discover
115
115
  - classify
116
116
  - sedit
117
- - bootdisk
118
117
  - irb_connect
119
118
  - ascii7
120
119
  - path
@@ -160,7 +159,6 @@ extra_rdoc_files:
160
159
  - lib/utils/file_xt.rb
161
160
  - lib/utils/finder.rb
162
161
  - lib/utils/grepper.rb
163
- - lib/utils/interactive_search.rb
164
162
  - lib/utils/irb.rb
165
163
  - lib/utils/irb/service.rb
166
164
  - lib/utils/line_blamer.rb
@@ -168,6 +166,7 @@ extra_rdoc_files:
168
166
  - lib/utils/md5.rb
169
167
  - lib/utils/patterns.rb
170
168
  - lib/utils/probe_server.rb
169
+ - lib/utils/search_ui.rb
171
170
  - lib/utils/ssh_tunnel_specification.rb
172
171
  - lib/utils/version.rb
173
172
  - lib/utils/xt/source_location_extension.rb
@@ -180,7 +179,6 @@ files:
180
179
  - VERSION
181
180
  - bin/ascii7
182
181
  - bin/blameline
183
- - bin/bootdisk
184
182
  - bin/brakeman2err
185
183
  - bin/chroot-exec
186
184
  - bin/chroot-libs
@@ -224,7 +222,6 @@ files:
224
222
  - lib/utils/file_xt.rb
225
223
  - lib/utils/finder.rb
226
224
  - lib/utils/grepper.rb
227
- - lib/utils/interactive_search.rb
228
225
  - lib/utils/irb.rb
229
226
  - lib/utils/irb/service.rb
230
227
  - lib/utils/line_blamer.rb
@@ -232,6 +229,7 @@ files:
232
229
  - lib/utils/md5.rb
233
230
  - lib/utils/patterns.rb
234
231
  - lib/utils/probe_server.rb
232
+ - lib/utils/search_ui.rb
235
233
  - lib/utils/ssh_tunnel_specification.rb
236
234
  - lib/utils/version.rb
237
235
  - lib/utils/xt/source_location_extension.rb
@@ -258,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
256
  - !ruby/object:Gem::Version
259
257
  version: '0'
260
258
  requirements: []
261
- rubygems_version: 3.0.6
259
+ rubygems_version: 3.0.3
262
260
  signing_key:
263
261
  specification_version: 4
264
262
  summary: Some useful command line utilities
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'json'
4
-
5
- value = `bdmesg`.lines.find { |l| l =~ /SelfDevicePath=(.*)\r/ and break $1 }
6
- uuid = value.split('\\').last[/(?:<?GPT,)([\h-]+)/, 1] or exit 1
7
- dev = `partutil --search-uuid #{uuid}`.chomp
8
- volname = `partutil --show-volumename #{dev}`.chomp
9
- disk = `partutil --show-wholedisk #{dev}`.chomp
10
- sdisk = `diskutil list #{disk}`.lines.grep(/Apple_APFS/).first.split(/\s+/)[4]
11
- vols = `diskutil list #{sdisk}`.lines.grep(/^\s*[1-9]\d*:/).join.scan(/(?:<?Volume\s+)(\S+)/).flatten
12
- jj({ dev: dev, volname: volname, uuid: uuid, disk: disk, sdisk: sdisk, vols: vols })