clipboardy
Advanced tools
Comparing version 1.0.2 to 1.1.0
22
index.js
'use strict'; | ||
const path = require('path'); | ||
const execa = require('execa'); | ||
const termux = require('./lib/termux.js'); | ||
const handler = err => { | ||
if (err.code === 'ENOENT') { | ||
throw new Error('Couldn\'t find the required `xsel` binary. On Debian/Ubuntu you can install it with: sudo apt install xsel'); | ||
let message = 'Couldn\'t find the required `xsel` binary. On Debian/Ubuntu you can install it with: sudo apt install xsel'; | ||
if (err.path === 'termux-clipboard-get' || err.path === 'termux-clipboard-set') { | ||
message = 'Couldn\'t find the termux-api scripts. You can install them with: apt install termux-api'; | ||
} | ||
throw new Error(message); | ||
} | ||
@@ -14,6 +19,6 @@ | ||
const darwin = { | ||
copy: opts => execa('pbcopy', [], opts), | ||
paste: opts => execa.stdout('pbpaste', [], opts), | ||
copySync: opts => execa.sync('pbcopy', [], opts), | ||
pasteSync: opts => execa.sync('pbpaste', [], opts) | ||
copy: opts => execa('pbcopy', opts), | ||
paste: opts => execa.stdout('pbpaste', opts), | ||
copySync: opts => execa.sync('pbcopy', opts), | ||
pasteSync: opts => execa.sync('pbpaste', opts) | ||
}; | ||
@@ -26,3 +31,3 @@ | ||
paste: opts => execa.stdout('cscript', ['/Nologo', winBinPath], opts), | ||
copySync: opts => execa.sync('clip', [], opts), | ||
copySync: opts => execa.sync('clip', opts), | ||
pasteSync: opts => execa.sync('cscript', ['/Nologo', winBinPath], opts) | ||
@@ -74,2 +79,7 @@ }; | ||
return win32; | ||
case 'android': | ||
if (process.env.PREFIX !== '/data/data/com.termux/files/usr') { | ||
throw new Error('You need to install Termux for this module to work on Android: https://termux.com'); | ||
} | ||
return termux(handler); | ||
default: | ||
@@ -76,0 +86,0 @@ return linux; |
{ | ||
"name": "clipboardy", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Access the system clipboard (copy/paste)", | ||
@@ -20,2 +20,3 @@ "license": "MIT", | ||
"index.js", | ||
"lib", | ||
"fallbacks", | ||
@@ -22,0 +23,0 @@ "vendor" |
@@ -5,3 +5,3 @@ # clipboardy [![Build Status: macOS & Linux](https://travis-ci.org/sindresorhus/clipboardy.svg?branch=master)](https://travis-ci.org/sindresorhus/clipboardy) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/gflt3gjn1ia0a3vo/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/clipboardy/branch/master) | ||
Cross-platform. Supports: macOS, Windows, Linux, OpenBSD, FreeBSD. | ||
Cross-platform. Supports: macOS, Windows, Linux, OpenBSD, FreeBSD, Android with [Termux](https://termux.com/). | ||
@@ -8,0 +8,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135895
7
113
2