Sha256: 738cbe59bd5effcc65288fe9cdd91c436d98cc9456a8f304d325d3e514b2a19c

Contents?: true

Size: 1.02 KB

Versions: 24

Compression:

Stored size: 1.02 KB

Contents

#!/usr/bin/env ruby

$-w = true
$:.unshift File.dirname($0) + '/../lib'

require 'pp'
require 'getoptlong'
require 'vpim/vcard'

HELP =<<EOF
Usage: #{$0} <vcard>...

Options
  -h,--help      Print this helpful message.

Examples:
EOF

opt_name  = nil
opt_debug = nil

opts = GetoptLong.new(
  [ "--help",    "-h",              GetoptLong::NO_ARGUMENT ],
  [ "--name",    "-n",              GetoptLong::NO_ARGUMENT ],
  [ "--debug",   "-d",              GetoptLong::NO_ARGUMENT ]
)

opts.each do |opt, arg|
  case opt
    when "--help" then
      puts HELP
      exit 0

    when "--name" then
      opt_name = true

    when "--debug" then
      opt_debug = true
  end
end

if ARGV.length < 1
  puts "no vcard files specified, try -h!"
  exit 1
end

ARGV.each do |file|

  cards = Vpim::Vcard.decode(open(file))

  cards.each do |card|
    card.lines.each_with_index do |line, i|
      print line.name
      if line.group.length > 0
        print " (", line.group, ")"
      end
      print ": ", line.value.inspect, "\n"
    end
  end
end

Version data entries

24 entries across 24 versions & 11 rubygems

Version Path
vpim-24.2.20 samples/vcf-lines.rb
fraser-vpim-0.658 samples/vcf-lines.rb
fraser-vpim-0.659 samples/vcf-lines.rb
fraser-vpim-rails-0.658 samples/vcf-lines.rb
fraser-vpim-rails-0.659 samples/vcf-lines.rb
xing-vpim-0.658.1 samples/vcf-lines.rb
vpim-13.11.11 samples/vcf-lines.rb
vpim2-0.0.1 samples/vcf-lines.rb
vpim-rails-reinteractive-0.7 samples/vcf-lines.rb
vpim-rails-0.665 samples/vcf-lines.rb
thoughtafter-vpim-0.7.0.1 samples/vcf-lines.rb
vpim-rails-0.664 samples/vcf-lines.rb
vpim-rails-0.663 samples/vcf-lines.rb
vpim-rails-0.662 samples/vcf-lines.rb
scashin133-vpim-9.4.0 samples/vcf-lines.rb
vpim-rails-0.661 samples/vcf-lines.rb
mumboe-vpim-0.7 samples/vcf-lines.rb
mumboe-vpim-0.695 samples/vcf-lines.rb
fairtilizer-vpim-0.695 samples/vcf-lines.rb
vpim-0.604 samples/vcf-lines.rb