Skip to content

Commit

Permalink
feat: pull string from clipboard repl globals
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Jul 30, 2023
1 parent 02db4fb commit b1f3026
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/repl_globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,22 @@ function copyToClipboard(text) {
}
global.copyToClipboard = copyToClipboard

function stringFromClipboard() {
const result = require("child_process").spawnSync("/usr/bin/pbpaste", [], {
env: {
LC_CTYPE: "UTF-8",
},
});

if (result.error) {
console.error('Error:', result.error);
return null;
}

return result.stdout.toString();
}
global.stringFromClipboard = stringFromClipboard

// https://stackoverflow.com/questions/332422/get-the-name-of-an-objects-type
function getClassName(target) {
const funcNameRegex = /function (.{1,})\(/
Expand Down

0 comments on commit b1f3026

Please sign in to comment.