bin/twoffein-client in twoffein-client-0.1.0 vs bin/twoffein-client in twoffein-client-0.1.1
- old
+ new
@@ -22,11 +22,11 @@
c.action do |global_options,options,args|
profile = args.first
#if options[:grep]
#puts Profiles.search(/#{options["grep"]}/i)
#else
- puts Profile.get profile
+ puts Profile.get(profile)
#end
end
end
desc "List all drinks"
@@ -34,15 +34,12 @@
command :drinks do |c|
c.desc "Grep all drinks"
c.flag :grep
c.action do |global_options,options,args|
- if options[:grep]
- puts Drinks.search(/#{options[:grep]}/i)
- else
- puts Drinks.new
- end
+ drinks = options[:grep] ? Drinks.search(/#{options[:grep]}/i) : Drinks.new
+ puts drinks.to_s
end
end
desc 'Tweet your drinking DRINK'
arg_name 'key_of_drink (see command "drinks")'
@@ -57,11 +54,11 @@
puts tweet.to_s
begin
info = tweet.publish unless DEBUG
puts 'Info: ' + info[:info] unless info.nil?
puts 'Drinks today: ' + info[:tweets].to_s if info && !info[:tweets].nil?
- rescue Twoffein::Error => e
+ rescue Server::Error => e
puts e.message
end
end
end
@@ -73,10 +70,10 @@
receiver = args.first
cookie = Cookie.new(receiver)
begin
info = cookie.send unless DEBUG
puts 'Info: ' + info[:info] unless info.nil?
- rescue Twoffein::Error => e
+ rescue Server::Error => e
puts e.message
end
end
end