Something went wrong. Try again.
A tool for measuring the coverage of Bluesky/ATProto relays forked from mackuba.eu/pulsar
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445require 'optparse'
def parse_options(argv) options = {}
parser = OptionParser.new do |opts| opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
opts.on('-d', '--duration SECONDS', Integer, 'Duration of the test in seconds') do |seconds| options[:duration] = seconds end
opts.on('-r', '--relays HOSTS', 'Only connect to these relays; can be comma-separated or passed multiple times') do |hosts| options[:relays] ||= [] options[:relays] += hosts.split(',').map(&:strip).reject(&:empty?) end
opts.on('-j', '--jetstreams HOSTS', 'Only connect to these jetstreams; can be comma-separated or passed multiple times') do |hosts| options[:jetstreams] ||= [] options[:jetstreams] += hosts.split(',').map(&:strip).reject(&:empty?) end
opts.on('-n', '--no-save', "Don't save report numbers to the database") do options[:dont_save] = true end
opts.on('-v', '--verbose [SECONDS]', 'Report the statistics to stdout during the test') do |seconds = 60| options[:verbose] = seconds.to_i end
opts.on('-h', '--help', 'Show help') do puts opts exit 0 end end
parser.parse!(argv)
optionsrescue OptionParser::ParseError => e warn e.message warn parser exit 1end