upm 0.1.11 → 0.1.12
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/VERSION +1 -1
- data/lib/upm/lesspipe.rb +9 -4
- data/lib/upm/tool_dsl.rb +9 -8
- data/lib/upm/tools/pkg.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bca79b16263ae9e7ac025695b61ec7bd88f81334b15564611e3f6977861ddcc
|
4
|
+
data.tar.gz: cbba1be68aa1f5deb00d59a0ec72ef912a790f04f2cccb7f185f6931eb8d76ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9642d123de6aaf546cc328c18ef942e0883bc526d53fe6eefd28cc10573220dccc9a1e6a308e68559459b3d2e22b2161cbda623b147095b3114ba97f711b6126
|
7
|
+
data.tar.gz: 9439866b904f66b394f9680c03bf8e77646bd493012696de2fd64335b38fed05263dda5ca04ed482dfd26a2d0e6a5628fbe57eb65da1c3409d54678b9bb552ef
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.12
|
data/lib/upm/lesspipe.rb
CHANGED
@@ -23,6 +23,8 @@
|
|
23
23
|
# :color => Allow ANSI colour codes?
|
24
24
|
# :wrap => Wrap long lines?
|
25
25
|
# :always => Always page, even if there's less than one page of text?
|
26
|
+
# :tail => Seek to the end of the stream
|
27
|
+
# :search => <regexp> searches the output using the "/" operator
|
26
28
|
#
|
27
29
|
def lesspipe(*args)
|
28
30
|
if args.any? and args.last.is_a?(Hash)
|
@@ -44,14 +46,17 @@ def lesspipe(*args)
|
|
44
46
|
end
|
45
47
|
|
46
48
|
params = []
|
47
|
-
params << "-R" unless options[:color]
|
48
|
-
params << "-S" unless options[:wrap]
|
49
|
+
params << "-R" unless options[:color] == false
|
50
|
+
params << "-S" unless options[:wrap] == true
|
49
51
|
params << "-F" unless options[:always] == true
|
50
|
-
|
52
|
+
params << "-X"
|
53
|
+
|
54
|
+
if regexp = options[:search]
|
55
|
+
params << "+/#{regexp}"
|
56
|
+
elsif options[:tail] == true
|
51
57
|
params << "+\\>"
|
52
58
|
$stderr.puts "Seeking to end of stream..."
|
53
59
|
end
|
54
|
-
params << "-X"
|
55
60
|
|
56
61
|
IO.popen("less #{params * ' '}", "w") do |less|
|
57
62
|
if output
|
data/lib/upm/tool_dsl.rb
CHANGED
@@ -33,7 +33,7 @@ module UPM
|
|
33
33
|
end
|
34
34
|
|
35
35
|
@cmds[name] = proc do |args|
|
36
|
-
query = highlight ? args.join("
|
36
|
+
query = highlight ? args.join("\\\\s+") : nil
|
37
37
|
run(*shell_command, *args, paged: paged, root: root, highlight: query)
|
38
38
|
end
|
39
39
|
|
@@ -85,11 +85,11 @@ module UPM
|
|
85
85
|
# IO.copy_stream(command_io, STDOUT)
|
86
86
|
# end
|
87
87
|
|
88
|
-
highlight_proc = if highlight
|
89
|
-
|
90
|
-
else
|
91
|
-
|
92
|
-
end
|
88
|
+
# highlight_proc = if highlight
|
89
|
+
# proc { |line| line.gsub(highlight) { |m| "\e[33;1m#{m}\e[0m" } }
|
90
|
+
# else
|
91
|
+
# proc { |line| line }
|
92
|
+
# end
|
93
93
|
|
94
94
|
grep_proc = if grep
|
95
95
|
proc { |line| line[grep] }
|
@@ -97,9 +97,10 @@ module UPM
|
|
97
97
|
proc { true }
|
98
98
|
end
|
99
99
|
|
100
|
-
lesspipe(disabled: !paged) do |less|
|
100
|
+
lesspipe(disabled: !paged, search: highlight, always: true) do |less|
|
101
101
|
command_io.each_line do |line|
|
102
|
-
less.puts highlight_proc.(line) if grep_proc.(line)
|
102
|
+
# less.puts highlight_proc.(line) if grep_proc.(line)
|
103
|
+
less.puts line if grep_proc.(line)
|
103
104
|
end
|
104
105
|
end
|
105
106
|
|
data/lib/upm/tools/pkg.rb
CHANGED
@@ -18,6 +18,8 @@ UPM::Tool.new "pkg" do
|
|
18
18
|
FreshportsSearch.new.search!(query)
|
19
19
|
end
|
20
20
|
|
21
|
+
command "log", "grep pkg: /var/log/messages", paged: true
|
22
|
+
|
21
23
|
command "build" do |*args|
|
22
24
|
# svn checkout --depth empty svn://svn.freebsd.org/ports/head /usr/ports
|
23
25
|
# cd /usr/ports
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- epitron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Wrap all known command-line package tools with a consistent and pretty
|
14
14
|
interface.
|