Skip to content

Commit

Permalink
Allow links like auth to auto open in browser
Browse files Browse the repository at this point in the history
Add method `open_link` to use mac `open` command line only if mac
Add method `is_mac` to determin if its a mac OS
  • Loading branch information
Ian Vaughan committed Apr 25, 2012
1 parent 893693d commit 61b2a40
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/console_tweet/cli.rb
Expand Up @@ -48,6 +48,7 @@ def get_access_token
request_token = @client.request_token
# ask the user to visit the auth url
puts "To authenticate your client, visit the URL: #{request_token.authorize_url}"
open_link request_token.authorize_url
# wait for the user to give us the PIN back
print 'Enter PIN: '
begin
Expand Down Expand Up @@ -230,6 +231,14 @@ def print_tweets(tweets)
end
end

def open_link url
exec "open #{url}" if is_mac?
end

def is_mac?
RUBY_PLATFORM.downcase.include?("darwin")
end

end

end

0 comments on commit 61b2a40

Please sign in to comment.