* Copy the content to host system clipboard. * This is only supported on Mac and Windows for now.
(content)
| 20 | * This is only supported on Mac and Windows for now. |
| 21 | */ |
| 22 | function copyToClipBoard(content) { |
| 23 | switch (process.platform) { |
| 24 | case 'darwin': |
| 25 | var child = spawn('pbcopy', []); |
| 26 | child.stdin.end(new Buffer(content, 'utf8')); |
| 27 | return true; |
| 28 | case 'win32': |
| 29 | var child = spawn('clip', []); |
| 30 | child.stdin.end(new Buffer(content, 'utf8')); |
| 31 | return true; |
| 32 | case 'linux': |
| 33 | var child = spawn(xsel, ['--clipboard', '--input']); |
| 34 | child.stdin.end(new Buffer(content, 'utf8')); |
| 35 | return true; |
| 36 | default: |
| 37 | return false; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | module.exports = copyToClipBoard; |
no test coverage detected
searching dependent graphs…