Last active
December 14, 2015 23:19
-
-
Save penguin2716/5164913 to your computer and use it in GitHub Desktop.
Postboxに入力した内容をmikutterコマンドとして実行するmikutterプラグイン
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
# -*- coding: utf-8 -*- | |
Plugin.create :post_as_mikutter_command do | |
command(:post_as_mikutter_command, | |
name: 'mikutterコマンドとして実行', | |
condition: lambda{ |opt| Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text.size > 0 }, | |
visible: true, | |
role: :postbox) do |opt| | |
begin | |
command = Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text | |
Plugin.call(:before_postbox_post, command) | |
result = Kernel.instance_eval(command) | |
Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text = "" | |
rescue Exception => e | |
Plugin.call(:update, nil, [Message.new(:message => e.to_s, :system => true)]) | |
e.backtrace | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment