Sha256: 709c37be3b44223e79d5a6dd7db28fa9791d68deccf546bd19b22672a2126fcb
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'user_agent_parser' require 'user_agent_parser/cli' options = {} optparse = OptionParser.new do|opts| opts.on('--name', 'Print name only') do options[:name] = true end opts.on('--version', 'Print version only') do options[:version] = true end opts.on('--major', 'Print major version only') do options[:major] = true end opts.on('--minor', 'Print minor version only') do options[:minor] = true end opts.on('--os', 'Print operating system only') do options[:os] = true end opts.on('--format format', 'Print output in specified format. The available formatters are:', ' - %n: name', ' - %v: version', ' - %M: major version', ' - %m: minor version', ' - %o: operating system' ) do |format| options[:format] = format end opts.on('-h', '--help', 'Display this screen') do puts opts exit end end optparse.parse! parser = UserAgentParser::Parser.new ARGF.each do |line| puts UserAgentParser::Cli.new(parser.parse(line), options).run! end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
user_agent_parser-2.1.5 | bin/user_agent_parser |
user_agent_parser-2.1.4 | bin/user_agent_parser |