TextMate Ruby代码段发布
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TextMate Ruby代码段发布相关的知识,希望对你有一定的参考价值。
#!/usr/bin/ruby $: << ENV['TM_SUPPORT_PATH'] + '/lib' require "ui" require "xmlrpc/client" unless ENV['SNIPPLR_KEY'] puts "Please first set your 'SNIPPLR_KEY' in Preferences > Advanced > Shell Variables." exit end unless ENV['TM_SELECTED_TEXT'] and ENV['TM_SELECTED_TEXT'].length > 0 puts "No text selected." exit end TextMate::UI.request_string(:title => "Post Snippet to Snipplr", :prompt => "Name this snippet:", :button1 => "Christen") do |title| TextMate::UI.request_string(:title => "Post Snippet to Snipplr", :prompt => "Enter tags (space-delimited):", :button1 => "Post") do |tags| begin snippet_list = server.call( 'snippet.post', ENV['SNIPPLR_KEY'], title, ENV['TM_SELECTED_TEXT'], tags) puts "Snippet successfully posted." rescue TextMate::UI.alert(:critical, "Snipplr error", "Could not post snippet.") end end end
以上是关于TextMate Ruby代码段发布的主要内容,如果未能解决你的问题,请参考以下文章