I’m trying to build a plugin for the web service Prefixr using cURL if it’s available on the system. I’m capable of getting the selections from all selection regions and concatenate them into one selection, however I’m then unable to concatenate them to a variable like:
cssComm = '"css=' + selectedCSS + "'"
I then have absolutely no idea how to take the output from cURL command and replace the selection with it
[code]import sublime, sublime_plugin
import os
class Prefixr(sublime_plugin.TextCommand):
def run(self, edit):
if not self.view.file_name():
return
selectedCSS = ""
for region in self.view.sel():
if not region.empty():
selectedCSS += self.view.substr(region)
cssComm = '"css='
cssComm += selectedCSS
cssComm += "'"
print cssComm
newCSS = self.view.window().run_command('exec', {'cmd': 'curl', '-sSd', cssComm, 'http://prefixr.com/api/index.php']})
self.view.sel()[0] = newCSS[/code]
Cheers.