Sha256: 1d25f4ffe89a8a964027185bdaf551490007b693a52b2a5da9a7c731ec3d3c10
Contents?: true
Size: 1.61 KB
Versions: 4
Compression:
Stored size: 1.61 KB
Contents
#!/usr/bin/env ruby require 'rubygems' require 'bundler' Bundler.setup require 'readonce' # No arguments: we stash a file, nothing else. if ARGV.count == 0 data = $stdin.read obj = ReadOnce.from_data(data) puts obj.read_url elsif ARGV.count == 1 && (ARGV[0] == '-h' || ARGV[0] == '--help') puts 'readonce -- provides a unique, one-time-use URL to share private data with someone.' puts 'Common uses:' puts ' readonce < myfile.txt # Share a file' puts ' echo "The password is foo" | readonce # Share a line of text' puts ' readonce -w < myfile.txt # Share a file, wait to exit until it is accessed' puts ' readonce -w <key> # Wait to exit until file with specified key is accessed' puts ' readonce -s <key> # Check the status of a file with specified key' elsif ARGV.count == 1 && ARGV[0] == '-w' # Stash file, block until gone. data = $stdin.read obj = ReadOnce.from_data(data) puts obj.read_url puts 'Waiting for file to be accessed...' obj.block_while_exists puts "File accessed at #{Time.zone.now} (local time)." elsif ARGV.count == 2 && ARGV[0] == '-w' # Block until gone. obj = ReadOnce.from_key(ARGV[1]) puts 'Waiting for file to be accessed...' obj.block_while_exists puts "File accessed at #{Time.zone.now} (local time)." elsif ARGV.count == 2 && ARGV[0] == '-s' # Get status of file obj = ReadOnce.from_key(ARGV[1]) if obj.exists? puts 'File has not been accessed.' else puts 'File does not exist (or has been accessed).' end else puts 'Invalid options. See readonce --help for details.' end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
readonce-1.0.3 | bin/readonce |
readonce-1.0.2 | exe/readonce |
readonce-1.0.1 | bin/readonce |
readonce-1.0.0 | bin/readonce |