ruaur 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ruaur +19 -8
  3. data/lib/ruaur/pacman.rb +4 -0
  4. data/lib/ruaur.rb +17 -13
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee660ebb69292cbb7d613cb076faa93bdcc1a502
4
- data.tar.gz: 159581b34b351e9a9030cf235f5e684aa950dc65
3
+ metadata.gz: d91f9f2007c3c871c47ae345664c5cb9ce041048
4
+ data.tar.gz: 23639fc12e377e9c68b33bd6221ae09ebafc17c0
5
5
  SHA512:
6
- metadata.gz: 29959cf32e4f6a75642b0dbb8b0fc23ca2cb4207925f1eaddcc0e43fd85268489ca7b6199fad0982bdd8c0f9fa7864a914330c23637c5f6915df67d6d5354a6c
7
- data.tar.gz: 60e1fc3e13337b25d1551e5940e1eef2c202502c051656fef77d43367c5bc6a58773833e8176c6217c7a3220358c8130b3195950f9ad285c54bb35551acd0a06
6
+ metadata.gz: 9e141fc80554db4a91b3072dd6f9fdd00d754775f50f63fbcf3ffa9b10a9b5d4a5b9580d901b3b05f51be302e0595394df068254bb91cfa1d44d386c4402ffb8
7
+ data.tar.gz: b9f129ec40899d191ee551469e4c4e8086f9f59a75d66a55fdce77f775a9046cb4c585ed2ea6ef24b357f9f6a6a5f1b08881b921c798da36fabb4f273458cdfb
data/bin/ruaur CHANGED
@@ -7,16 +7,17 @@ require "ruaur"
7
7
  class Flags
8
8
  # Query
9
9
  INFO = 1
10
+ OWNS = 2
10
11
 
11
12
  # Remove
12
- NOSAVE = 2
13
+ NOSAVE = 3
13
14
 
14
15
  # Sync
15
- CLEAN = 3
16
- NAMES_ONLY = 4
17
- NOCONFIRM = 5
18
- SEARCH = 6
19
- UPGRADE = 7
16
+ CLEAN = 4
17
+ NAMES_ONLY = 5
18
+ NOCONFIRM = 6
19
+ SEARCH = 7
20
+ UPGRADE = 8
20
21
  end
21
22
 
22
23
  class Operation
@@ -110,6 +111,14 @@ def parse(args)
110
111
  options["flags"].push(Flags::INFO)
111
112
  end
112
113
 
114
+ opts.on(
115
+ "-o",
116
+ "--owns",
117
+ "Search for packages that own the specified file(s)"
118
+ ) do
119
+ options["flags"].push(Flags::OWNS)
120
+ end
121
+
113
122
  opts.on("", "REMOVE_OPTIONS")
114
123
 
115
124
  opts.on("-n", "--nosave", "Completely remove package") do
@@ -183,7 +192,8 @@ def validate(options)
183
192
  case options["operation"]
184
193
  when Operation::QUERY
185
194
  flags = options["flags"].select do |flag|
186
- flag != Flags::INFO
195
+ (flag != Flags::INFO) &&
196
+ (flag != Flags::OWNS)
187
197
  end
188
198
  return false if (!flags.empty?)
189
199
  when Operation::REMOVE
@@ -241,7 +251,8 @@ begin
241
251
  when Operation::QUERY
242
252
  ruaur.query(
243
253
  options["packages"],
244
- options["flags"].include?(Flags::INFO)
254
+ options["flags"].include?(Flags::INFO),
255
+ options["flags"].include?(Flags::OWNS)
245
256
  )
246
257
  when Operation::REMOVE
247
258
  ruaur.remove(
data/lib/ruaur/pacman.rb CHANGED
@@ -99,6 +99,10 @@ class RuAUR::Pacman
99
99
  return results
100
100
  end
101
101
 
102
+ def query_owns(file_names)
103
+ return %x(#{@pac_nocolor} -Qo #{file_names})
104
+ end
105
+
102
106
  def remove(pkg_names, nosave = false)
103
107
  puts hilight_status("Removing #{pkg_names.join(" ")}...")
104
108
  if (!nosave)
data/lib/ruaur.rb CHANGED
@@ -57,19 +57,23 @@ class RuAUR
57
57
  unlock
58
58
  end
59
59
 
60
- def query(pkg_names, info = false)
61
- pkg_names.each do |pkg_name|
62
- results = @pacman.query(pkg_name, info)
63
- results.each do |name, details|
64
- print "#{name} " if (!info)
65
- puts details
66
- puts if (info)
67
- end
68
- results = @aur.query(pkg_name, info)
69
- results.each do |name, details|
70
- print "#{name} " if (!info)
71
- puts details
72
- puts if (info)
60
+ def query(pkg_names, info = false, owns = false)
61
+ if (owns)
62
+ puts @pacman.query_owns(pkg_names.join(" "))
63
+ else
64
+ pkg_names.each do |pkg_name|
65
+ results = @pacman.query(pkg_name, info)
66
+ results.each do |name, details|
67
+ print "#{name} " if (!info)
68
+ puts details
69
+ puts if (info)
70
+ end
71
+ results = @aur.query(pkg_name, info)
72
+ results.each do |name, details|
73
+ print "#{name} " if (!info)
74
+ puts details
75
+ puts if (info)
76
+ end
73
77
  end
74
78
  end
75
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruaur
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker