upm 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/upm/lesspipe.rb +34 -11
- data/lib/upm/tool_dsl.rb +3 -3
- data/lib/upm/tools/apk.rb +23 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 675637d1104dcbf53a07642dcce7385e24d83019730394a28662aba0146e6445
|
4
|
+
data.tar.gz: '04598f9d40c671d90ff4a129cae40426ed33c332632a570366d238159a4156fb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b7503c5afe5f88a482611ca8dc9b05a1189571522e4b7c5234e4651f15e418fe106e9ec627ab164aa0edc9bf6584004e1415bcbbc068e2cdff93bea5889eb94
|
7
|
+
data.tar.gz: 569590e5f1e8298a63ea04cfa784c52316868535acf40f1f74f8c1307b3708ffe5ae1cc0330f27efdd8359eb7a6e3f10279d51d146505d404dc9031071a422f7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.13
|
data/lib/upm/lesspipe.rb
CHANGED
@@ -46,19 +46,42 @@ def lesspipe(*args)
|
|
46
46
|
end
|
47
47
|
|
48
48
|
params = []
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
params << "
|
58
|
-
|
49
|
+
|
50
|
+
less_bin = File.which("less")
|
51
|
+
|
52
|
+
if File.symlink?(less_bin) and File.readlink(lessbin)[/busybox$/]
|
53
|
+
# busybox less only supports one option!
|
54
|
+
params << "-S" unless options[:wrap] == true
|
55
|
+
else
|
56
|
+
# authentic less
|
57
|
+
params << "-R" unless options[:color] == false
|
58
|
+
params << "-S" unless options[:wrap] == true
|
59
|
+
params << "-F" unless options[:always] == true
|
60
|
+
params << "-X"
|
61
|
+
params << "-I"
|
62
|
+
|
63
|
+
if regexp = options[:search]
|
64
|
+
params << "+/#{regexp}"
|
65
|
+
elsif options[:tail] == true
|
66
|
+
params << "+\\>"
|
67
|
+
$stderr.puts "Seeking to end of stream..."
|
68
|
+
end
|
59
69
|
end
|
60
70
|
|
61
|
-
|
71
|
+
env = {
|
72
|
+
"LESS_TERMCAP_mb" => "\e[01;31m",
|
73
|
+
"LESS_TERMCAP_md" => "\e[01;37m",
|
74
|
+
"LESS_TERMCAP_me" => "\e[0m",
|
75
|
+
"LESS_TERMCAP_se" => "\e[0m",
|
76
|
+
# "LESS_TERMCAP_so" => "\e[30;44m", # highlight: black on blue
|
77
|
+
"LESS_TERMCAP_so" => "\e[01;44;33m", # highlight: bright yellow on blue
|
78
|
+
# "LESS_TERMCAP_so" => "\e[30;43m", # highlight: black on yellow
|
79
|
+
"LESS_TERMCAP_ue" => "\e[0m",
|
80
|
+
"LESS_TERMCAP_us" => "\e[01;32m",
|
81
|
+
}
|
82
|
+
|
83
|
+
IO.popen(env, [less_bin, *params], "w") do |less|
|
84
|
+
# less.puts params.inspect
|
62
85
|
if output
|
63
86
|
less.puts output
|
64
87
|
else
|
data/lib/upm/tool_dsl.rb
CHANGED
@@ -17,9 +17,9 @@ module UPM
|
|
17
17
|
@cmds ||= {}
|
18
18
|
|
19
19
|
if block_given?
|
20
|
-
|
20
|
+
|
21
21
|
if root and Process.uid != 0
|
22
|
-
exec("sudo", $PROGRAM_NAME, *ARGV)
|
22
|
+
@cmds[name] = proc { exec("sudo", $PROGRAM_NAME, *ARGV) }
|
23
23
|
else
|
24
24
|
@cmds[name] = block
|
25
25
|
end
|
@@ -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
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
UPM::Tool.new "apk" do
|
2
|
+
|
3
|
+
os "alpine"
|
4
|
+
|
5
|
+
command "install", "apk add", root: true
|
6
|
+
command "update", "apk update", root: true
|
7
|
+
command "upgrade", "apk upgrade", root: true
|
8
|
+
|
9
|
+
command "files", "apk info -L", paged: true
|
10
|
+
command "search", "apk search", paged: true
|
11
|
+
|
12
|
+
command "clean", "apk clean"
|
13
|
+
|
14
|
+
command "list" do |args|
|
15
|
+
if args.any?
|
16
|
+
query = args.join
|
17
|
+
run "apk", "info", grep: query, paged: true
|
18
|
+
else
|
19
|
+
run "apk", "info", paged: true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- epitron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-16 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.
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/upm/tool.rb
|
39
39
|
- lib/upm/tool_class_methods.rb
|
40
40
|
- lib/upm/tool_dsl.rb
|
41
|
+
- lib/upm/tools/apk.rb
|
41
42
|
- lib/upm/tools/apt.rb
|
42
43
|
- lib/upm/tools/pacman.rb
|
43
44
|
- lib/upm/tools/pkg.rb
|