Sha256: 242a9ad409c9cec550ef17e446d96ac2416310762f4942705202424974e02452
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
#!/usr/bin/env ruby require 'netprint' require 'docopt' program_name = File.basename($0) doc =<<-EOS Usage: #{program_name} [--user=<userid:password>] [--email=<email>] [--secret=<secret>] <filename> #{program_name} -h | --help Options: -h --help Show this screen. -v --version Show version information. -u --user=<userid:password> User account. If not specified, ENV['NETPRINT_(USERID|PASSWORD)'] is used. -e --email=<email> Email address to notify. If not specified, ENV['NETPRINT_EMAIL'] is used. -s --secret=<secret> Secret code. EOS begin options = Docopt::docopt(doc, :version => Netprint::VERSION) userid, password = options['--user'].split(':') if options['--user'] netprint = Netprint::Agent.new( userid || ENV['NETPRINT_USERID'], password || ENV['NETPRINT_PASSWORD']) netprint.login code = netprint.upload(options['<filename>'], :email => options['--email'] || ENV['NETPRINT_EMAIL'], :secret_code => options['--secret']) puts code rescue Docopt::Exit => e puts e.message end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
netprint-0.1.1 | bin/netprint |