Sha256: 443d001994b860efa02f4a50eaf08cb3efd653d1ccf84f6b0bacce3780acb16d
Contents?: true
Size: 1.57 KB
Versions: 4
Compression:
Stored size: 1.57 KB
Contents
#!/usr/bin/env ruby require 'rubygems' 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.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.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.9 | bin/readonce |
readonce-1.0.8 | bin/readonce |
readonce-1.0.7 | bin/readonce |
readonce-1.0.5 | bin/readonce |