Sha256: 4af0309a633562f75698168237fc3b2936f44e7a7e3c99e5af9e3cba5178b5b5

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

#!/usr/bin/env ruby
# encoding: utf-8

require 'optparse'
require 'photo_party_sync'

options = {}
options[:quiet] = false
# options[:verbose] = false
options[:cards] = []
options[:dir] = ''
options[:watch] = false

optparse = OptionParser.new do |opts|
  opts.banner = "Usage: upload_files.rb [options]\nDefault host: #{options[:server]}"

  opts.on('-q', '--quiet', 'Only output error messages') do
    options[:quiet] = true
  end

  # opts.on("-v", "--verbose", "Show extra output") do
  # 	@options[:verbose] = true
  # end

  opts.on('--watch', 'Run forever an keep watching for available cards') do
    options[:watch] = true
  end

  opts.on('-c [CARD]', '--card [CARD]', 'Name of the card to parse') do |card|
    options[:cards] << PhotoPartySync::Card.new(card)
  end

  opts.on('-f [CARD]', '--card-file [CARD]', 'Name of the card file to parse (one card per line)') do |card|
    options[:cards] = open(card).read.split("\n").collect { |name| PhotoPartySync::Card.new(name) }
  end

  opts.on('-d [DIR]', '--directory [DIR]', 'Directory to where the files are downloaded') do |dir|
    options[:dir] = File.realdirpath(dir)
  end
end
optparse.parse!

photo_sync = PhotoPartySync::Watcher.new(options)

if options[:watch]
  photo_sync.watch
else
  photo_sync.check_all
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
photo_party_sync-0.1.0 bin/photo_party_sync