Class: Certs::Search
- Inherits:
-
Object
- Object
- Certs::Search
- Defined in:
- lib/cert-help/search.rb
Class Method Summary collapse
Class Method Details
.certs(term) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cert-help/search.rb', line 17 def certs(term) certs = [] searchAux(certs, term) if certs.size > 0 puts certs else puts "Couldn't find any certs" end end |
.execute(command) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/cert-help/search.rb', line 5 def execute(command) return help if command.nil? || ['help', '-h', '--help'].include?(command) return certs(command) end |
.help ⇒ Object
12 13 14 15 |
# File 'lib/cert-help/search.rb', line 12 def help puts "#{Certs::COMMAND} search <term>" puts "<term> search for a particular term" end |
.searchAux(certs, term) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cert-help/search.rb', line 30 def searchAux(certs, term) results = `security find-certificate -a -c "#{term}"` match = /"alis"<blob>="(.*)"$/.match(results) return false if match.nil? match.captures.each do |c| certs << c end end |