utils 0.41.0 → 0.42.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/create_tags +1 -1
- data/bin/discover +4 -7
- data/bin/json_check +1 -1
- data/bin/search +4 -5
- data/lib/utils/grepper.rb +5 -2
- data/lib/utils/irb.rb +1 -1
- data/lib/utils/line_blamer.rb +1 -9
- data/lib/utils/probe_server.rb +2 -2
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2261e1420324f65e6793524f113440a9cecfcc6a4026da61957d5991aa6237b0
|
4
|
+
data.tar.gz: c954c1928241f54ab0d37aff885f95ba26d4c7ed786814e5efd4028a18499a69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a9c602a87e531234c595ffb91cdc3c18b690400cc59f52b49ffa2a5032b5425add0acc032898ddd8c3ed529c53c5451edca0e4fae9f24813e70275388f4356c
|
7
|
+
data.tar.gz: 5511eaae6e97cd9069ab65164eedccaab6db0fb3636d8724dcc392de2eb9fdd3c70a60812027044999ce1f151216e1857af921778e5d744aec0706588fb2c786
|
data/bin/create_tags
CHANGED
@@ -4,7 +4,7 @@ require 'infobar'
|
|
4
4
|
|
5
5
|
paths = %w[ . ] + `bundle list --paths`.lines.map(&:chomp)
|
6
6
|
cmd = %w[ ctags --recurse=yes --languages=Ruby,C ] + paths
|
7
|
-
Infobar.busy(label: 'Creating tags') { system
|
7
|
+
Infobar.busy(label: 'Creating tags') { system(*cmd) }
|
8
8
|
if megabytes = File.size('tags').to_f / 1024 ** 2 rescue nil
|
9
9
|
infobar.puts 'Created %.3fM of tags.' % megabytes
|
10
10
|
end
|
data/bin/discover
CHANGED
@@ -12,7 +12,7 @@ def edit_files(*paths, pick: false, wait: true)
|
|
12
12
|
if pick
|
13
13
|
if paths.size > 1
|
14
14
|
path = complete(prompt: 'Pick? ') do |p|
|
15
|
-
paths.grep
|
15
|
+
paths.grep(/#{p}/)
|
16
16
|
end
|
17
17
|
else
|
18
18
|
path = paths.first
|
@@ -83,7 +83,6 @@ search = -> * {
|
|
83
83
|
f = nil
|
84
84
|
pattern = pattern.dup
|
85
85
|
args[?n] = Term::ANSIColor.terminal_lines - 1
|
86
|
-
path = nil
|
87
86
|
found = Search.new(
|
88
87
|
match: -> answer {
|
89
88
|
pattern.replace answer
|
@@ -95,9 +94,7 @@ search = -> * {
|
|
95
94
|
matches.each_with_index.map { |l, i| (i == selector ? '> ' : ' ') + l }.join(?\n)
|
96
95
|
},
|
97
96
|
found: -> _answer, matches, selector {
|
98
|
-
if f
|
99
|
-
path = f.paths[selector]
|
100
|
-
end
|
97
|
+
f.paths[selector] if f
|
101
98
|
},
|
102
99
|
output: STDERR
|
103
100
|
).start
|
@@ -117,9 +114,9 @@ case
|
|
117
114
|
when args[?s]
|
118
115
|
search.()
|
119
116
|
when args[?E]
|
120
|
-
edit_files
|
117
|
+
edit_files(*finder.().paths, pick: true)
|
121
118
|
when args[?e]
|
122
|
-
edit_files
|
119
|
+
edit_files(*finder.().search.paths)
|
123
120
|
when args[?D]
|
124
121
|
args[?d] = true
|
125
122
|
paths = finder.().load_paths.select { |p| File.directory?(p) }.reverse
|
data/bin/json_check
CHANGED
data/bin/search
CHANGED
@@ -18,7 +18,7 @@ end
|
|
18
18
|
|
19
19
|
def read_line(path)
|
20
20
|
filename, lineno = path.source_location
|
21
|
-
|
21
|
+
File.open(filename) do |file|
|
22
22
|
file.lazy.each_with_index.select { |l, n| n + 1 == lineno }.first&.first
|
23
23
|
end
|
24
24
|
end
|
@@ -71,8 +71,6 @@ def replace_ask(editor, path, pattern, replace, all)
|
|
71
71
|
when ?e
|
72
72
|
editor.edit(path.strip)
|
73
73
|
break false
|
74
|
-
when ?a
|
75
|
-
break true
|
76
74
|
else
|
77
75
|
next
|
78
76
|
end
|
@@ -95,7 +93,7 @@ def edit_files(pattern, paths, pick: false, replace: nil)
|
|
95
93
|
when pick
|
96
94
|
if paths.size > 1
|
97
95
|
path = complete(prompt: 'Pick? ') do |p|
|
98
|
-
paths.grep
|
96
|
+
paths.grep(/#{p}/)
|
99
97
|
end
|
100
98
|
else
|
101
99
|
path = paths.first
|
@@ -139,6 +137,7 @@ Options are
|
|
139
137
|
-r REPLACE replace the searched match with REPLACE
|
140
138
|
-b also search binary files
|
141
139
|
-g use git to determine author of the line
|
140
|
+
-G AUTHOR only display lines authored by AUTHOR
|
142
141
|
-a CSET use only character set CSET from PATTERN
|
143
142
|
-v be verbose
|
144
143
|
-h display this help
|
@@ -148,7 +147,7 @@ Version is #{File.basename($0)} #{Utils::VERSION}.
|
|
148
147
|
exit 1
|
149
148
|
end
|
150
149
|
|
151
|
-
args = go 'r:p:I:A:B:C:s:S:n:N:a:i:cfFlLeEvbgh'
|
150
|
+
args = go 'r:p:I:A:B:C:s:S:n:N:a:i:G:cfFlLeEvbgh'
|
152
151
|
args[?h] and usage
|
153
152
|
pattern = ARGV.shift or usage
|
154
153
|
roots = (ARGV.empty? ? [ Dir.pwd ] : ARGV).map { |f| File.expand_path(f) }
|
data/lib/utils/grepper.rb
CHANGED
@@ -97,9 +97,12 @@ class Utils::Grepper
|
|
97
97
|
@output.each do |l|
|
98
98
|
blamer = LineBlamer.for_line(l)
|
99
99
|
if blame = blamer.perform
|
100
|
+
author = nil
|
100
101
|
blame.sub!(/^[0-9a-f^]+/) { Term::ANSIColor.yellow($&) }
|
101
|
-
blame.sub!(/\(([^)]+)\)/) { "(#{Term::ANSIColor.red($1)})" }
|
102
|
-
|
102
|
+
blame.sub!(/\(([^)]+)\)/) { author = $1; "(#{Term::ANSIColor.red($1)})" }
|
103
|
+
if !@args[?G] || author&.downcase&.match?(@args[?G].downcase)
|
104
|
+
puts "#{blame.chomp} #{Term::ANSIColor.blue(l)}"
|
105
|
+
end
|
103
106
|
end
|
104
107
|
end
|
105
108
|
when @args[?l], @args[?e], @args[?E], @args[?r]
|
data/lib/utils/irb.rb
CHANGED
data/lib/utils/line_blamer.rb
CHANGED
@@ -5,15 +5,7 @@ module Utils
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.for_line(line)
|
8
|
-
location = line.source_location and new
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.blame(line)
|
12
|
-
blamer = for_line(line)
|
13
|
-
if blame = blamer.perform
|
14
|
-
blame.sub!(/^[0-9a-f^]+/) { Term::ANSIColor.yellow($&) }
|
15
|
-
blame.sub!(/\(([^)]+)\)/) { "(#{Term::ANSIColor.red($1)})" }
|
16
|
-
end
|
8
|
+
location = line.source_location and new(*location)
|
17
9
|
end
|
18
10
|
|
19
11
|
def perform(options = '')
|
data/lib/utils/probe_server.rb
CHANGED
@@ -89,7 +89,7 @@ module Utils
|
|
89
89
|
def help
|
90
90
|
docs = doc_annotations.sort_by(&:first)
|
91
91
|
docs_size = docs.map { |a| a.first.size }.max
|
92
|
-
format =
|
92
|
+
format = "%-#{docs_size}s %-3s %s"
|
93
93
|
output_message [
|
94
94
|
(format % %w[ command sho description ]).on_color(20).white
|
95
95
|
] << docs.map { |cmd, doc|
|
@@ -198,7 +198,7 @@ module Utils
|
|
198
198
|
|
199
199
|
def run_job(job)
|
200
200
|
output_message " → #{job.inspect} now running.", type: :info
|
201
|
-
system
|
201
|
+
system(*cmd(job.args))
|
202
202
|
message = " → #{job.inspect} was just run"
|
203
203
|
if $?.success?
|
204
204
|
job.ok = true
|
data/lib/utils/version.rb
CHANGED
data/utils.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: utils 0.
|
2
|
+
# stub: utils 0.42.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "utils".freeze
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.42.0".freeze
|
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 = "2024-04-
|
11
|
+
s.date = "2024-04-24"
|
12
12
|
s.description = "This ruby gem provides some useful command line utilities".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
14
|
s.executables = ["ascii7".freeze, "blameline".freeze, "check-yaml".freeze, "classify".freeze, "create_cstags".freeze, "create_tags".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "fix-brew".freeze, "git-empty".freeze, "git-versions".freeze, "irb_connect".freeze, "json_check".freeze, "long_lines".freeze, "myex".freeze, "number_files".freeze, "on_change".freeze, "path".freeze, "probe".freeze, "rd2md".freeze, "search".freeze, "sedit".freeze, "serve".freeze, "ssh-tunnel".freeze, "strip_spaces".freeze, "sync_dir".freeze, "untest".freeze, "utils-utilsrc".freeze, "vcf2alias".freeze]
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.homepage = "http://github.com/flori/utils".freeze
|
18
18
|
s.licenses = ["GPL-2.0".freeze]
|
19
19
|
s.rdoc_options = ["--title".freeze, "Utils - Some useful command line utilities".freeze, "--main".freeze, "README.md".freeze]
|
20
|
-
s.rubygems_version = "3.5.
|
20
|
+
s.rubygems_version = "3.5.9".freeze
|
21
21
|
s.summary = "Some useful command line utilities".freeze
|
22
22
|
|
23
23
|
s.specification_version = 4
|
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.
|
4
|
+
version: 0.42.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: 2024-04-
|
11
|
+
date: 2024-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
281
|
- !ruby/object:Gem::Version
|
282
282
|
version: '0'
|
283
283
|
requirements: []
|
284
|
-
rubygems_version: 3.5.
|
284
|
+
rubygems_version: 3.5.9
|
285
285
|
signing_key:
|
286
286
|
specification_version: 4
|
287
287
|
summary: Some useful command line utilities
|