Last active
December 26, 2015 12:59
-
-
Save babie/7155110 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TwitterOAuth | |
class Client | |
def update_profile(params) | |
post("/account/update_profile.json", params) | |
end | |
end | |
end | |
Earthquake.init do | |
command :me do | |
input(%Q|:user #{twitter.info['screen_name']}|) | |
end | |
help :me, "show myself info" | |
%w[name description url location].each do |word| | |
command word.to_sym do |m| | |
text = _eval_as_ruby_string(m[1]) | |
async_e { twitter.update_profile word.to_sym => text } if confirm("update #{word} '#{text}'") | |
end | |
if word == "description" | |
alias_command :bio, :description | |
command %r|^:#{word}$|, :as => word.to_sym do | |
puts "[input EOF (e.g. Ctrl+D) at the last]".c(:info) | |
system "stty icrnl brkint" | |
text = STDIN.gets(nil) | |
text = _eval_as_ruby_string(text) | |
if text && !text.split.empty? | |
async_e { twitter.update_profile word.to_sym => text } if confirm("update #{word} above AA?") | |
end | |
end | |
alias_command %r|^:bio$|, :description | |
help word.to_sym, "update #{word}", <<-HELP | |
⚡ :#{word} this is my new #{word} | |
⚡ :#{word}[ENTER] | |
⚡ | |
⚡ | |
⚡ | |
⚡ | |
^D | |
HELP | |
end | |
help word.to_sym, "update #{word}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment