import subprocess
import csv
import os

import platform

SYSTEM = platform.system()

COMMAND_MAPPING = {
    'Linux': {"PASTE_CMD": ['xclip', '-o', '-selection', 'clipboard'], 'COPY_CMD': ['xclip', '-selection', 'clipboard']},
    'Darwin': {"PASTE_CMD": ['pbpaste'], 'COPY_CMD': ['pbcopy']},
    'Windows': {"PASTE_CMD": ['paste'], 'COPY_CMD': ['clip']},
}

PASTE_CMD = COMMAND_MAPPING.get(SYSTEM).get('PASTE_CMD')
COPY_CMD = COMMAND_MAPPING.get(SYSTEM).get('COPY_CMD')


def paste(selection=None):
	pipe = subprocess.Popen(PASTE_CMD, stdout=subprocess.PIPE)
	outdata, errdata = pipe.communicate()
	return outdata

def copy(text):
	pipe = subprocess.Popen(COPY_CMD, stdin=subprocess.PIPE)
	pipe.communicate(text)

def paste_table():
	text = paste()
	data = list(csv.reader(text.split('\n'), delimiter='\t'))
	return data

@@ -493,17 +493,68 @@
 =None):%0A
-%09
+    with open(os.devnull, 'wb') as devnull:%0A        
 pipe = s
@@ -602,19 +602,42 @@
 ess.PIPE
-)%0A%09
+, stderr=devnull)%0A        
 outdata,
@@ -670,122 +670,333 @@
 e()%0A
-%09return outdata%0A%0Adef copy(text):%0A%09pipe = subprocess.Popen(COPY_CMD, stdin=subprocess.PIPE)%0A%09pipe.communicate(text)
+    if pipe.returncode:%0A        return False%0A    else:%0A        return outdata%0A%0Adef copy(text):%0A    with open(os.devnull, 'wb') as devnull:%0A        pipe = subprocess.Popen(COPY_CMD, stdin=subprocess.PIPE, stderr=devnull)%0A        pipe.communicate(text)%0A    if pipe.returncode:%0A        return False%0A    else:%0A        return True
 %0A%0Ade

add feature