now-flow
Version:
Add deployment workflows to Zeit now
31 lines (24 loc) • 477 B
JavaScript
// @flow
// Packages
const { write } = require('clipboardy')
const copyToClipboard = async (str, shouldCopy, isTTY) => {
if (shouldCopy === false) {
return false
}
if (shouldCopy === 'auto') {
if (isTTY) {
await write(str)
return true
} else {
return false
}
}
if (shouldCopy === true) {
await write(str)
return true
}
throw new TypeError(
'The `copyToClipbard` value in now config has an invalid type'
)
}
module.exports = copyToClipboard