Ticket #28531: patch-pastebinit-pbcopy.diff
File patch-pastebinit-pbcopy.diff, 1.5 KB (added by BlackFrog1, 14 years ago) |
---|
-
pastebinit
old new 160 160 def getFirstNodeText(nodes, title): 161 161 return getText(getFirstNode(nodes, title).childNodes) 162 162 163 # Use Mac OS X pbcopy to paste url to clipboard 164 def copyToClipboard(url): 165 clipboard = os.popen("pbcopy", "w") 166 clipboard.write(url) 167 clipboard.close() 168 163 169 # Display usage instructions 164 170 def Usage(): 165 171 print "pastebinit v" + version … … 331 337 page = url_opener.open(website, params) #Send the informations and be redirected to the final page 332 338 333 339 try: 340 pasteURL = "" # the url of where we can file the paste 334 341 if reLink: #Check if we have to apply a regexp 335 342 website = website.replace(tmp_page, "") 336 343 if reLink == '(.*)': 337 p rintpage.read().strip()344 pasteURL = page.read().strip() 338 345 else: 339 p rintwebsite + re.split(reLink, page.read())[1] #Print the result of the Regexp346 pasteURL = website + re.split(reLink, page.read())[1] #Print the result of the Regexp 340 347 else: 341 print page.url #Get the final page and show the ur 348 pasteURL = page.url #Get the final page and show the url 349 350 # copy the url to the clipboard 351 copyToClipboard(pasteURL) 352 print pasteURL # output paste url to stdout 353 342 354 except KeyboardInterrupt: 343 355 sys.exit(_("KeyboardInterrupt caught.")) 344 356 except: