utils 0.91.1 → 0.93.0
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/.contexts/lib.rb +23 -0
- data/bin/discover +1 -1
- data/bin/search +1 -1
- data/lib/utils/config_file.rb +3 -2
- data/lib/utils/finder/files.rb +1 -1
- data/lib/utils/grepper.rb +1 -1
- data/lib/utils/irb/shell.rb +3 -3
- data/lib/utils/line_formatter.rb +20 -7
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +3 -3
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4412a2649cf7a18654f0cdec0cf7fa86ba33cb15c8cf88e2ef1ba10267753cd4
|
|
4
|
+
data.tar.gz: 30095f823b5fad6f66e79667d82f88757d47f04d28cde52fe7706c1731331d6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0aa5db98d16b760637beb04b4fa5fcd99cb951854b9bb6f8714bc350f2351bb2acbe26fc2220e35b7caf3e079f0b19c3fa74f218bc44107ad03d98c7cbbcb5c2
|
|
7
|
+
data.tar.gz: fdb6289ad43454ed499fbdf9ae17051d5b24e93c474dc9ddc81c1f34661135e1c5275bc9dfee6b0b505a017c5a64b9c8c8a28e1caa744f9d7ae255e4ea115951
|
data/.contexts/lib.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
context do
|
|
2
|
+
namespace "structure" do
|
|
3
|
+
command "tree", tags: %w[ project_structure ]
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
namespace "lib" do
|
|
7
|
+
Dir['lib/**/*.rb'].each do |filename|
|
|
8
|
+
file filename, tags: 'lib'
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
namespace "gems" do
|
|
13
|
+
file Dir['*.gemspec'].first
|
|
14
|
+
file 'Gemfile'
|
|
15
|
+
file 'Gemfile.lock'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
file 'Rakefile', tags: 'gem_hadar'
|
|
19
|
+
|
|
20
|
+
file 'README.md', tags: 'documentation'
|
|
21
|
+
|
|
22
|
+
meta ruby: RUBY_DESCRIPTION
|
|
23
|
+
end
|
data/bin/discover
CHANGED
|
@@ -94,7 +94,7 @@ Version is #{File.basename($0)} #{Utils::VERSION}.
|
|
|
94
94
|
exit 1
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
args = go 'n:I:i:a:p:lLcreEvdsDgh', defaults: { ?a => '\\w' }
|
|
97
|
+
args = go 'n:I:i:a:p:P:lLcreEvdsDgh', defaults: { ?a => '\\w' }
|
|
98
98
|
args[?h] and usage
|
|
99
99
|
|
|
100
100
|
Term::ANSIColor.coloring = (STDIN.tty? && ENV['TERM'] !~ /dumb/) && !args[?c]
|
data/bin/search
CHANGED
|
@@ -227,7 +227,7 @@ def usage
|
|
|
227
227
|
exit 1
|
|
228
228
|
end
|
|
229
229
|
|
|
230
|
-
args = go 'r:p:I:A:B:C:s:S:n:N:a:i:G:cfFlLeEvgh'
|
|
230
|
+
args = go 'r:p:I:A:B:C:s:S:n:N:a:i:G:P:cfFlLeEvgh'
|
|
231
231
|
args[?h] and usage
|
|
232
232
|
pattern = ARGV.shift or usage
|
|
233
233
|
roots = (ARGV.empty? ? [ Dir.pwd ] : ARGV).map { |f| File.expand_path(f) }
|
data/lib/utils/config_file.rb
CHANGED
|
@@ -205,8 +205,9 @@ class Utils::ConfigFile
|
|
|
205
205
|
#
|
|
206
206
|
# @return [ TrueClass, FalseClass ] true if the basename matches any prune pattern,
|
|
207
207
|
# false otherwise
|
|
208
|
-
def prune?(basename)
|
|
209
|
-
Array(prune_dirs)
|
|
208
|
+
def prune?(basename, additional_dirs: nil)
|
|
209
|
+
([ Array(prune_dirs), Array(additional_dirs) ].compact.flatten).
|
|
210
|
+
any? { |pd| pd.match(basename.to_s) }
|
|
210
211
|
end
|
|
211
212
|
|
|
212
213
|
# The skip? method determines whether a file should be skipped based on
|
data/lib/utils/finder/files.rb
CHANGED
|
@@ -155,7 +155,7 @@ module Utils::Finder::Files
|
|
|
155
155
|
s = filename.stat
|
|
156
156
|
bn = filename.pathname.basename
|
|
157
157
|
if !s ||
|
|
158
|
-
s.directory? && @config.discover.prune?(bn) ||
|
|
158
|
+
s.directory? && @config.discover.prune?(bn, additional_dirs: @args[?P]) ||
|
|
159
159
|
s.file? && @config.discover.skip?(bn)
|
|
160
160
|
then
|
|
161
161
|
@args[?v] and warn "Pruning #{filename.inspect}."
|
data/lib/utils/grepper.rb
CHANGED
|
@@ -138,7 +138,7 @@ class Utils::Grepper
|
|
|
138
138
|
@filename = filename
|
|
139
139
|
@output = []
|
|
140
140
|
bn, s = File.basename(filename), File.stat(filename)
|
|
141
|
-
if !s || s.directory? && @config.search.prune?(bn)
|
|
141
|
+
if !s || s.directory? && @config.search.prune?(bn, additional_dirs: @args[?P])
|
|
142
142
|
@args[?v] and warn "Pruning #{filename.inspect}."
|
|
143
143
|
prune
|
|
144
144
|
end
|
data/lib/utils/irb/shell.rb
CHANGED
|
@@ -67,8 +67,8 @@ module Utils::IRB::Shell
|
|
|
67
67
|
ri(*patterns, doc: 'yri')
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
# The
|
|
71
|
-
#
|
|
70
|
+
# The ocs method interacts with an Ollama chat service to process queries and
|
|
71
|
+
# optionally return responses.
|
|
72
72
|
#
|
|
73
73
|
# This method constructs command-line arguments for the ollama_chat_send
|
|
74
74
|
# utility based on the provided options, executes the command with the
|
|
@@ -85,7 +85,7 @@ module Utils::IRB::Shell
|
|
|
85
85
|
#
|
|
86
86
|
# @return [ String, nil ] the response from the Ollama chat service if
|
|
87
87
|
# respond is true, otherwise nil
|
|
88
|
-
def
|
|
88
|
+
def ocs(query, command: false, respond: false, parse: false, dir: ?.)
|
|
89
89
|
dir = File.expand_path(dir)
|
|
90
90
|
args = {
|
|
91
91
|
?r => respond,
|
data/lib/utils/line_formatter.rb
CHANGED
|
@@ -258,7 +258,7 @@ else
|
|
|
258
258
|
# full description or abbreviated version
|
|
259
259
|
#
|
|
260
260
|
# @return [ String ] the appropriate description based on the full parameter value
|
|
261
|
-
def description(example, full:
|
|
261
|
+
def description(example, full: true)
|
|
262
262
|
if full
|
|
263
263
|
example.example.full_description
|
|
264
264
|
else
|
|
@@ -296,9 +296,22 @@ else
|
|
|
296
296
|
failed: ?❌,
|
|
297
297
|
pending: ?⏩
|
|
298
298
|
)
|
|
299
|
-
|
|
300
|
-
uncolored
|
|
301
|
-
|
|
299
|
+
description = self.description(example)
|
|
300
|
+
uncolored = nil
|
|
301
|
+
cols = Tins::Terminal.columns - 1
|
|
302
|
+
redone = false
|
|
303
|
+
1.times do
|
|
304
|
+
args = [ status_emoji[status], location(example), run_time(example), description ]
|
|
305
|
+
uncolored = "%s %s # %3.3fs %s" % args
|
|
306
|
+
if !redone && uncolored.size > cols
|
|
307
|
+
description = self.description(example, full: false)
|
|
308
|
+
redone = true
|
|
309
|
+
redo
|
|
310
|
+
else
|
|
311
|
+
break
|
|
312
|
+
end
|
|
313
|
+
end
|
|
314
|
+
uncolored = uncolored[0, cols]
|
|
302
315
|
case status
|
|
303
316
|
when :passed
|
|
304
317
|
success_color(uncolored)
|
|
@@ -322,7 +335,7 @@ else
|
|
|
322
335
|
#
|
|
323
336
|
# @return [ String ] the input text wrapped with green color ANSI escape codes
|
|
324
337
|
def success_color(text)
|
|
325
|
-
Term::ANSIColor.
|
|
338
|
+
Term::ANSIColor.bright_green(text)
|
|
326
339
|
end
|
|
327
340
|
|
|
328
341
|
# The failure_color method applies red color formatting to the provided
|
|
@@ -336,7 +349,7 @@ else
|
|
|
336
349
|
#
|
|
337
350
|
# @return [ String ] the colorized text wrapped with red formatting codes
|
|
338
351
|
def failure_color(text)
|
|
339
|
-
Term::ANSIColor.
|
|
352
|
+
Term::ANSIColor.bright_red(text)
|
|
340
353
|
end
|
|
341
354
|
|
|
342
355
|
# The pending_color method applies yellow color formatting to the
|
|
@@ -350,7 +363,7 @@ else
|
|
|
350
363
|
#
|
|
351
364
|
# @return [ String ] the colorized text with yellow formatting applied
|
|
352
365
|
def pending_color(text)
|
|
353
|
-
Term::ANSIColor.
|
|
366
|
+
Term::ANSIColor.bright_yellow(text)
|
|
354
367
|
end
|
|
355
368
|
|
|
356
369
|
# The location method extracts and formats the file path and line number
|
data/lib/utils/version.rb
CHANGED
data/utils.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: utils 0.
|
|
2
|
+
# stub: utils 0.93.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.93.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]
|
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.email = "flori@ping.de".freeze
|
|
14
14
|
s.executables = ["ascii7".freeze, "blameline".freeze, "changes".freeze, "classify".freeze, "code_comment".freeze, "code_indexer".freeze, "commit_message".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "git-empty".freeze, "git-versions".freeze, "irb_client".freeze, "json_check".freeze, "long_lines".freeze, "myex".freeze, "on_change".freeze, "path".freeze, "print_method".freeze, "probe".freeze, "rainbow".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, "yaml_check".freeze]
|
|
15
15
|
s.extra_rdoc_files = ["README.md".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/config_file/block_config.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/finder/files.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/irb_server.rb".freeze, "lib/utils/irb/regexp.rb".freeze, "lib/utils/irb/shell.rb".freeze, "lib/utils/irb/shell/wrappers.rb".freeze, "lib/utils/irb/string.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.rb".freeze, "lib/utils/probe/probe_client.rb".freeze, "lib/utils/probe/probe_server.rb".freeze, "lib/utils/probe/process_job.rb".freeze, "lib/utils/probe/server_handling.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xdg.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze]
|
|
16
|
-
s.files = ["Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/changes".freeze, "bin/classify".freeze, "bin/code_comment".freeze, "bin/code_indexer".freeze, "bin/commit_message".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_client".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/print_method".freeze, "bin/probe".freeze, "bin/rainbow".freeze, "bin/rd2md".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/sync_dir".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vcf2alias".freeze, "bin/yaml_check".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/config_file/block_config.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/finder/files.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/irb_server.rb".freeze, "lib/utils/irb/regexp.rb".freeze, "lib/utils/irb/shell.rb".freeze, "lib/utils/irb/shell/wrappers.rb".freeze, "lib/utils/irb/string.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.rb".freeze, "lib/utils/probe/probe_client.rb".freeze, "lib/utils/probe/probe_server.rb".freeze, "lib/utils/probe/process_job.rb".freeze, "lib/utils/probe/server_handling.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xdg.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "tests/test_helper.rb".freeze, "tests/utils_test.rb".freeze, "utils.gemspec".freeze]
|
|
16
|
+
s.files = [".contexts/lib.rb".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/changes".freeze, "bin/classify".freeze, "bin/code_comment".freeze, "bin/code_indexer".freeze, "bin/commit_message".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_client".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/print_method".freeze, "bin/probe".freeze, "bin/rainbow".freeze, "bin/rd2md".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/sync_dir".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vcf2alias".freeze, "bin/yaml_check".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/config_file/block_config.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/finder/files.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/irb_server.rb".freeze, "lib/utils/irb/regexp.rb".freeze, "lib/utils/irb/shell.rb".freeze, "lib/utils/irb/shell/wrappers.rb".freeze, "lib/utils/irb/string.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.rb".freeze, "lib/utils/probe/probe_client.rb".freeze, "lib/utils/probe/probe_server.rb".freeze, "lib/utils/probe/process_job.rb".freeze, "lib/utils/probe/server_handling.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xdg.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "tests/test_helper.rb".freeze, "tests/utils_test.rb".freeze, "utils.gemspec".freeze]
|
|
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]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.93.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -341,6 +341,7 @@ extra_rdoc_files:
|
|
|
341
341
|
- lib/utils/xdg.rb
|
|
342
342
|
- lib/utils/xt/source_location_extension.rb
|
|
343
343
|
files:
|
|
344
|
+
- ".contexts/lib.rb"
|
|
344
345
|
- Gemfile
|
|
345
346
|
- LICENSE
|
|
346
347
|
- README.md
|