readFromClipboard() — astro Function Reference
Architecture documentation for the readFromClipboard() function in cli.test.js from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 56e56095_8394_61b2_e304_f6a82519ebbd["readFromClipboard()"] 64a48040_bc58_2a5b_7755_774708915f1f["cli.test.js"] 56e56095_8394_61b2_e304_f6a82519ebbd -->|defined in| 64a48040_bc58_2a5b_7755_774708915f1f style 56e56095_8394_61b2_e304_f6a82519ebbd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/test/cli.test.js lines 16–54
function readFromClipboard() {
const system = process.platform;
let command = '';
let args = [];
if (system === 'darwin') {
command = 'pbpaste';
} else if (system === 'win32') {
command = 'powershell';
args = ['-command', 'Get-Clipboard'];
} else {
const unixCommands = [
['xclip', ['-sel', 'clipboard', '-o']],
['wl-paste', []],
];
for (const [unixCommand, unixArgs] of unixCommands) {
try {
const output = spawnSync('which', [unixCommand], { encoding: 'utf8' });
if (output.stdout.trim()) {
command = unixCommand;
args = unixArgs;
break;
}
} catch {
continue;
}
}
}
if (!command) {
throw new Error('Clipboard read command not found!');
}
const result = spawnSync(command, args, { encoding: 'utf8' });
if (result.error) {
throw result.error;
}
return result.stdout.trim();
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does readFromClipboard() do?
readFromClipboard() is a function in the astro codebase, defined in packages/astro/test/cli.test.js.
Where is readFromClipboard() defined?
readFromClipboard() is defined in packages/astro/test/cli.test.js at line 16.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free