#!/usr/bin/env ruby # # For a query command, mutt expects output of the form: # # informational line # TAB[TAB] # ... # # For an alias command, mutt expects output of the form: # alias NICKNAME EMAIL # # NICKNAME shouldn't have spaces, and EMAIL can be either "user@example.com", # "", or "User ". $-w = true $:.unshift File.dirname($0) + '/../lib' require 'getoptlong' require 'vpim/vcard' HELP =<" end end end end cards = Vpim::Vcard.decode($stdin) matches = Mutt::vcard_query(cards, opt_query) if opt_aliases Mutt::alias_print(matches) else qstr = opt_query == '' ? '' : opt_query; Mutt::query_print(matches, "Query #{qstr} against #{cards.size} vCards:") end