ruaur 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ruaur +28 -4
  3. data/lib/ruaur.rb +8 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 812c350958fcf9664dcd677716c5a99bfb14ded4
4
- data.tar.gz: 8fead82484d3d24a2fb2b3f149d45786337354cf
3
+ metadata.gz: 1e57d42d9b3d1663c54209614bc74d2456c2e753
4
+ data.tar.gz: 16489235f35b22d06c472bab63caee9155dbaaa8
5
5
  SHA512:
6
- metadata.gz: d726438c357af881e60a7712ca35095fb4632af8cb77d54d71870cca91848d37b18c3d03977f6b74c8c85716258be9a34d52fa121107a3cbf5c363bbf828ed13
7
- data.tar.gz: ef4b3266eee94077932d2f068e3d30a57ac62e2db6da94b5ea0bbcdbfba48555f194a7c95dc2dfe7d1966d8166a9ba8c765e1e3026315f3df8464b52246c2829
6
+ metadata.gz: 43c0d20fc43a98c8455dd30a842d649e526458cc8aa21c9dff2bc9c4719e465283606027acab3f212612e91fe88590e01047e01e973f02ac2e1951758d3d657d
7
+ data.tar.gz: cbfc6b8459c4181ac636ed997d11dca1a36041f1a0908fe5e3690cde42953c371770b8fe91b74179e22d1ac3c94dbdc1c9947cb21b2597d73976c8075ac26a84
data/bin/ruaur CHANGED
@@ -25,6 +25,7 @@ def parse(args)
25
25
 
26
26
  # Sync options
27
27
  options["clean"] = false
28
+ options["names-only"] = false
28
29
  options["noconfirm"] = false
29
30
  options["search"] = false
30
31
  options["upgrade"] = false
@@ -65,9 +66,16 @@ def parse(args)
65
66
  options["clean"] = true
66
67
  end
67
68
 
69
+ opts.on(
70
+ "--names-only",
71
+ "Only show package names (useful for tab-completion)",
72
+ ) do
73
+ options["names-only"] = true
74
+ end
75
+
68
76
  opts.on(
69
77
  "--noconfirm",
70
- "Bypass any and all \"Are you sure?\" messages."
78
+ "Bypass any and all \"Are you sure?\" messages"
71
79
  ) do
72
80
  options["noconfirm"] = true
73
81
  end
@@ -122,6 +130,7 @@ def validate(options)
122
130
  when Operation::REMOVE
123
131
  if (
124
132
  options["clean"] ||
133
+ options["names-only"] ||
125
134
  options["noconfirm"] ||
126
135
  options["search"] ||
127
136
  options["upgrade"]
@@ -132,11 +141,23 @@ def validate(options)
132
141
  return false if (options["nosave"])
133
142
 
134
143
  if (options["clean"])
135
- return false if (options["search"] || options["upgrade"])
144
+ if (
145
+ options["names-only"] ||
146
+ options["search"] ||
147
+ options["upgrade"]
148
+ )
149
+ return false
150
+ end
136
151
  elsif (options["search"])
137
152
  return false if (options["clean"] || options["upgrade"])
138
153
  elsif (options["upgrade"])
139
- return false if (options["clean"] || options["search"])
154
+ if (
155
+ options["clean"] ||
156
+ options["names-only"] ||
157
+ options["search"]
158
+ )
159
+ return false
160
+ end
140
161
  end
141
162
  else
142
163
  return false
@@ -158,7 +179,10 @@ begin
158
179
  if (options["clean"])
159
180
  ruaur.clean(options["noconfirm"])
160
181
  elsif (options["search"])
161
- puts ruaur.search(options["packages"].join(" "))
182
+ puts ruaur.search(
183
+ options["packages"].join(" "),
184
+ options["names-only"]
185
+ )
162
186
  elsif (options["upgrade"])
163
187
  ruaur.upgrade(options["noconfirm"])
164
188
  else
data/lib/ruaur.rb CHANGED
@@ -58,8 +58,14 @@ class RuAUR
58
58
  unlock
59
59
  end
60
60
 
61
- def search(string)
62
- return @pacman.search(string).concat(@aur.search(string))
61
+ def search(string, names_only = false)
62
+ found = @pacman.search(string).concat(@aur.search(string))
63
+ return found if (!names_only)
64
+ names = Array.new
65
+ found.each do |pkg|
66
+ names.push(pkg.name) if (!names.include?(pkg.name))
67
+ end
68
+ return names
63
69
  end
64
70
 
65
71
  def unlock
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruaur
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: archive-tar-minitar