cli-ux
cli-ux copied to clipboard
[FEATURE] `cli.copy` to copy items to clipboard
It would be great to have a cli.copy('some_string') feature to copy items to the clipboard.
Historically, I've done something like:
const { copy } = require('copy-paste');
const copyToClipboard = async text => {
try {
await copy(text);
return true;
} catch (err) {
return false;
}
};
module.exports = {
copyToClipboard
};
Where it's usage would look like:
await terminal.copyToClipboard(something);
this.log('output copied to clipboard!')