Sha256: 13997c4ef4f0a2ff1dce859a10807fac6c68116a8ec90b7e01e0e9b702b93039
Contents?: true
Size: 859 Bytes
Versions: 6
Compression:
Stored size: 859 Bytes
Contents
require 'usaidwat/client' require 'usaidwat/command' module USaidWat module Application class Info < Command def initialize(prog) prog.command(:info) do |c| c.action do |args, options| process(options, args) end end super end def process(options, args) raise ArgumentError.new('You must specify a username') if args.empty? username = args.shift redditor = client.new(username) created_at = redditor.created_at.strftime("%b %d, %Y %H:%M %p") puts "Created: #{created_at} (#{redditor.age})" printf "Link Karma: %d\n", redditor.link_karma printf "Comment Karma: %d\n", redditor.comment_karma rescue USaidWat::Client::NoSuchUserError quit "No such user: #{username}", :no_such_user end end end end
Version data entries
6 entries across 6 versions & 1 rubygems