Sha256: 86315c7e9b894bd4b2c10aaab44cfc53e13561559e263584914f4e23d1fd74dd
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
#!/usr/bin/env ruby require 'rubygems' if RUBY_VERSION =~ /1\.8/ require 'bundler/setup' require 'slop' require 'pingfm' opts = Slop.parse!(:help => true) do banner "Usage: #{File.basename(__FILE__)} [options] <message>" on :debug, 'Enable debugging' do $DEBUG = true end # TODO: Implement these. # on :c, :config, 'Use the specified (YAML) config file', :optional => false # on :l, :latest, 'List your latest <count> posts', :optional => false # on :t, :title, 'Title of the post' on :version, 'Print the version' do STDOUT.puts "Ping.fm v#{Pingfm::VERSION}" exit end end if ARGV.empty? STDERR.puts "Must provide a message." STDERR.puts # spacer STDERR.puts opts.help exit end # Join ARGV just in case the user didn't quote the message. message = ARGV.join(' ') begin app_key = Pingfm::Config['app_key'] rescue Pingfm::ConfigNotFound => error app_key = Pingfm::Config.ask_for_app_key! Pingfm::Config['app_key'] = app_key end client = Pingfm::Client.new(app_key) response = client.post(message) if response['status'] == 'OK' STDOUT.puts 'Message sent.' else STDERR.puts response['message'] end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pingfm-2.1.2 | bin/pingfm |
pingfm-2.1.0 | bin/pingfm |