cli-ux icon indicating copy to clipboard operation
cli-ux copied to clipboard

[FEATURE] `cli.copy` to copy items to clipboard

Open shaunwarman opened this issue 6 years ago • 0 comments

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!')

shaunwarman avatar May 04 '19 16:05 shaunwarman