copy() — astro Function Reference
Architecture documentation for the copy() function in cli-clipboard.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 3ad241c4_c0ac_6abd_74d9_bace3166794d["copy()"] 0298f775_eac8_8d68_fb9a_0a62fdf019ad["CliClipboard"] 3ad241c4_c0ac_6abd_74d9_bace3166794d -->|defined in| 0298f775_eac8_8d68_fb9a_0a62fdf019ad bdb8cade_1848_e664_6a3e_430f16db9d94["getExecInputForPlatform()"] 3ad241c4_c0ac_6abd_74d9_bace3166794d -->|calls| bdb8cade_1848_e664_6a3e_430f16db9d94 style 3ad241c4_c0ac_6abd_74d9_bace3166794d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/cli/info/infra/cli-clipboard.ts lines 59–94
async copy(text: string): Promise<void> {
text = text.trim();
const platform = this.#operatingSystemProvider.name;
const input = await getExecInputForPlatform({
platform,
commandExecutor: this.#commandExecutor,
});
if (!input) {
this.#logger.warn('SKIP_FORMAT', 'Clipboard command not found!');
this.#logger.info('SKIP_FORMAT', 'Please manually copy the text above.');
return;
}
if (
!(await this.#prompt.confirm({
message: 'Copy to clipboard?',
defaultValue: true,
}))
) {
return;
}
try {
const [command, args] = input;
await this.#commandExecutor.execute(command, args, {
input: text,
stdio: ['pipe', 'ignore', 'ignore'],
});
this.#logger.info('SKIP_FORMAT', 'Copied to clipboard!');
} catch {
this.#logger.error(
'SKIP_FORMAT',
'Sorry, something went wrong! Please copy the text above manually.',
);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does copy() do?
copy() is a function in the astro codebase, defined in packages/astro/src/cli/info/infra/cli-clipboard.ts.
Where is copy() defined?
copy() is defined in packages/astro/src/cli/info/infra/cli-clipboard.ts at line 59.
What does copy() call?
copy() calls 1 function(s): getExecInputForPlatform.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free