-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: correctly copy to clipboard in astro info
#12641
Conversation
🦋 Changeset detectedLatest commit: 8063bee The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #12641 will not alter performanceComparing Summary
|
astro info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Left some feedback. I didn't test the code myself
packages/astro/src/cli/info/index.ts
Outdated
throw result.error; | ||
} | ||
console.log(colors.green('Copied to clipboard!')); | ||
} catch (err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused (thank you github annotations)
packages/astro/src/cli/info/index.ts
Outdated
if (!shouldCopy) return; | ||
if (!command) { | ||
console.error(colors.red('\nClipboard command not found!')); | ||
console.log('Please manually copy the text above.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use .info
instead. Usually .log
is more for debugging
packages/astro/src/cli/info/index.ts
Outdated
if (result.error) { | ||
throw result.error; | ||
} | ||
console.log(colors.green('Copied to clipboard!')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use .info
Co-authored-by: Emanuele Stoppa <[email protected]>
Changes
astro info
copy to clipboard has not been working on Mac because piping the input topbcopy
usingexecSync
seems to not work. This PR fixes that by switching tospawnSync
instead ofexecSync
. It also adds a helper to read from the clipboard so we can check it works across platforms, and adds support for a--copy
flag to avoid needing to prompt.Fixes #12639
Testing
Adds a new test suite.
Docs